Hello Everyone!! when I type (y or Y) or (n or N) it correspondingly outputs the according to code. Also outputs "please enter correctly.." when I type say bean, dasdjaw etc but when I type (yes or Yes) or (no or No) or anything starting with y/Y/n/N.
it should say "please enter correctly.." since I specified that in code but rather it shows "Correct" and "Incorrect" respectively.
Does it mean, char takes only first character of user input not the whole string. also how do I fix it???
ans is a single char. One char. If you try to store more than one character in it (for example, the word "yes", which contains THREE characters), things will go wrong.
You cannot store more than one character in a char. If you want to store more than one character, use a string.