I know this piece of code won't work but can you guys help me to get it working? Basically, I just want the program to do this, whenever it waits for an output, if y is inserted then it prints 'blah', if n is inserted then it prints 'blahblah', (Sorry for this bad explanation but it's 12.44 AM and i'm pretty tired to correct my spelling and poor grammar, I just want to learn as much C++ as possible. :D)
Thank you so much, i've been waiting about a half an hour for an answer and you solved my mystery and explained it, thanks! Is there a way for the program to ignore upper-case/lower-case letters. I can't really explain this well but I can show you an example, if I enter the character "n", nothing will pop up because it's lower-case and our program only identifies upper-case "N". Is there a way to ignore case-sensitivity. I know there is a way to do it in Python but I have unfortunately forgotten it.
Now if the user typed a lowercase letter, it is automatically read as uppercase. And if it was entered in uppercase already, it stays that way.
Also, this if (answer == 'Y' || 'y') is wrong coding. If you are trying to check both upper and lower, it should be if (answer == 'Y' || answer == 'y'). Same for the else if part.
Calling the getchar() function has a side effect, so it would be better to store the result of the first getchar() in a variable and test against the variable;