You need to use && instead of || here. Say you have entered 'Y'. So 1st test yn!
= 'Y' is false but 2nd test yn! = 'y' is true. So the condition is true, as they are ORed.
That's why it is entering the loop again.
Yn! = 'Y' || yn! = 'y' || yn!
= 'N' || yn! = 'n' You need to use && instead of || here. Say you have entered 'Y'.
So 1st test yn! = 'Y' is false but 2nd test yn! = 'y' is true.So the condition is true, as they are ORed.
That's why it is entering the loop again.
Even if I use &&... it still doesn't work – newbie Dec 2 '10 at 11:30 Please post that code. May be you are making some mistake. – taskinoor Dec 2 '10 at 11:31 thanks a lot :) – newbie Dec 2 '10 at 11:35.
You mean && not ||. The variable "yn" is one character. For that expression to evaluate to false, that character would have to be Y, y, N, and n simultaneously, which is impossible.
You need: while(yn! = 'y' && yn! = 'Y' && yn!
= 'n' && yn! = 'N').
1 for the nice explanation. – taskinoor Dec 2 '10 at 11:44 And -1 from someone else for no apparent reason. I think I know who though.
– AlastairG Dec 2 '10 at 13:18.
The logic in the while statement is flawed, you need logical AND (&&) instead of logical OR (||). Also, this would be a good place to use do { ... } while().
The condition for the while loop is nested ORs. For it to work you might want to change them into ANDs: do { yn = getch() } while(yn! = 'Y' && yn!
= 'y' && yn! = 'N' && yn! = 'n').
Use of getch() function #include #include //main function starts excuition viod main() { clrscr();//to clear the screen //veriable decleration int a;//Any integer int b;//Any integer int c;//Any integer cout>a;//read the integer cout>b;//read integer c = a + b;//the value of xum of "a" and "b" is assigned to "c" cout.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.