I am having trouble with this code. I am supposed to make it to where if there is a number inputted for TV_Type that is not between 0 and 100 the program will display an invalid message and closes the program. Also, I am supposed to align the decimal places in the output screen. Any help would be greatly appreciated.
int tv_type = 0;
cin >> tv_type;
if (tv_type >= 0 && tv_type <= 100){
// your code
}
else{
cout << "Invalid entry, exiting" << endl;
exit(1)
}
you could use almost any other loop you are comfortable with to do this as well. Also, why do you need tv_type to be between 0 and 100 since there are only 2 types?