Thread: Alphabet Program Help!!!!!!!

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    5

    Angry Alphabet Program Help!!!!!!!

    To whomever can help me,

    I am a beginner at C programming and have very little knowledge of the subject as a whole. I need to develope a program that has you enter a letter, say 'D', and return the letters before and after the letter entered. For example, entering 'D' will return 'C' and 'E'. Or entering 'A' will return 'Z' and 'B'. I have no idea how to approach this. If anyone has an example program I could follow as a guide that would be great! Any programs, references, info is greatly appreciated! Thank you very much!

    Dave

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    http://www.cprogramming.com/tutorial.html

    This is a good place to start learning the basic stuff.

    Regarding you question, start by reading a character, then print that characters value +1 resp. -1
    Code:
    printf("%c, %c", (MyChar - 1), (MyChar + 1));
    You have to make special cases for A and Z though. You could also use modulus, but since that is a little more advanced topic, stick to the first.

    (Why does every new person print a smiley in the topic???)
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    5
    Thanks for the help, Magos; but I have a few more questions! How do you read in a character. Our teacher just dropped us into the alphabet and character stuff and didn't do a very good job explaining. Any advice?

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Any advice?
    Ask your teacher. So many students don't seem to understand that the teacher is paid to help you learn, don't just walk off and try to fumble your way to a solution if you don't understand.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM