I'm not going to post any code (unless it's requested) because I think someone with alittle more C++ knowledge then myself could probably answer this quickly.
I'm building a program, and I coded it to where it prompts the user for the input and regardless it'll trigger the while statement ( I put the condition to input == input). I then seperate the input into if, else if, and else statements to give the desired out put, and it works fine for the most part. The users first input, and subsequently the input that determines what output is given, is int. However while testing the program I accidentally hit a letter and inputted it, and it sent it into an infinite loop.
I figure that's because the letter is char and the input is supposed to be int. So is there anyway for the program to pick up on char characters and give an output such as "invalid" or something to prevent it from going off into an infinite loop.?
(Be awere that if the char is invalid, strtol() will store 0 into the integer. You have to check or this is the case, since its probably not what you want)
I'll try to decipher exactly how to do that in a moment, but real quick another stupid question. What would be the best way to go about aligning right? I read it's defaulted but I can't figure out what's aligning left then.