• C

Using function prototypes with a loop

I am writing a program to use global function prototypes. So far I have the functions working the way I want but
the last last part of the loop will not print the letter and terminate the program. Can any body help? I can not use
global variables and goto statements. I have six letters to let the user pick from,('A/a','B/b','P/p','X/x','y/y',or'Q/q')
once the letter is chosen, it prints out as an upper case version using the lower case letter. If the letter 'Q' or 'q'
is used it is supposed to print out the upper case version and terminate. This is where I am having the problem.
The program starts:
#include <stdio.h>
void prn_A(void);
void prn_B(void);
void prn_P(void);
void prn_X(void);
void prn_Y(void);
void prn_Q(void);
void main ()
  char ch;
      { printf("Enter one of the following upper or lower case letters, A/a, B/b, P/p, X/x, Y/y or (Q/q to quit)"  );
            if(ch=='Q' || ch=='q')
                else if(ch=="A' || ch=='a')
                else if(ch=='B' || ch=='b')
                else if(ch=='P' || ch=='p')
                else if(ch=='X' || ch=='x')
                else if(ch=='Y' || ch=='y')
       while(ch!='Q' || ch!='q');
       void prn_A(void)
         printf("This is where it prints the upper case version of 'A' using lower case 'a'");
       void prn_B(void)
        printf("This is where it prints the upper case version of 'B' using lower case 'b'");
       void prn_P(void)
        printf("This is where it prints the upper case version of 'P' using lower case 'p'");
And so on, the remaining letters are the same. As I said, everything works up to the point where I try to print
the letter 'Q' and terminate the program. I am new at this so please have patience with my programing.            
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cstudentAuthor Commented:
Edited text of question
I think line
while(ch!='Q' || ch!='q');

should be
while(ch !='Q' && ch !='q');

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cstudentAuthor Commented:
Thanks for the info. It worked just fine. My only question is why the && and not the || ?
Don't both conditions have to be true using && ? Thanks again. cstudent
Well, think about it

when you say while(ch != 'Q' || ch != 'q')
you are telling the computer you want to stay in the
loop if ch is not Q or ch is not q.  Since ch will
never be Q and q at the same time.  So, the loop continues for
cstudentAuthor Commented:
Thanks for the explanation. It helped a lot.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.