Hello everyone.
I am new to C++ and I am currently working through a book that is helping me out a lot.
I created an infinite for loop that will take numbers that users input and add them together. I have an int variable inside my for loop that adds to the total int outside the for loop.
I want the for loop to break if what they type is not a number. Currently, if you type in a NaN, it continously outputs text.
Something like:
if(NaN(total))
{
break;
}
Any help would be greatly appreciated.
I am new to C++ and I am currently working through a book that is helping me out a lot.
I created an infinite for loop that will take numbers that users input and add them together. I have an int variable inside my for loop that adds to the total int outside the for loop.
I want the for loop to break if what they type is not a number. Currently, if you type in a NaN, it continously outputs text.
Something like:
if(NaN(total))
{
break;
}
Any help would be greatly appreciated.
Comment