First off, indent your code properly: that is hard to read and work out what is going on. This is particularly a problem when you do things like this:
if (choice != n && choice !=N)
{
cout << "\n\n\n\n\n\n\n\nThank You and Goodbye\n";
}
{
if (choice == y && choice == Y)
cout << "\n";
}
Second, this test is silly:
if (choice != n && choice !=N)
because
choice
is char, and both
n
and
N
are integers, neither of which gets a value. The same applies to your "Yes" test. Probably, you should dump the variables
n
,
N
,
y
, and
Y
and use tests like this:
if (choice != 'n' && choice != 'N')
{
cout << "\n\n\n\n\n\n\n\nThank You and Goodbye\n";
}
Thirdly, the AND text in your "Yes" question won't work, even if you fix the characters:
if (choice == 'y' && choice == 'Y')
a variable cannot have two different values at the same time. You want to use "||" as an OR operation instead of "&&" as an AND.
Fourthly, where do you think your while loop should end? Fixing the indentation should help you see what is wrong there...
And please, have a look at that code: you are duplicating a load of stuff that you could easily refactor into more readable - and maintainable - form. Also consider using a
switch
instead of loads inf if comparisons.