Hi all, I have a problem with this. Let's say for distance one, the user enters a number less than 0. It would be a negative number and show that to the user. If the user enters a number greater than 0, then it will show the user that it's positive. When I tried to respond to the question "You have selected air. Enter the distance" with a number, it didn't reply anything back to me. How can I solve this?
#include <iostream>
usingnamespace std;
int main()
{
int Choice;
cout << "Choose 1 - 5 ";
cin >> Choice;
switch (Choice)
{
case 1:
{
cout << "This is a negative number";
// More code here if you wish
}
break;
case 2:
{
cout << "This is a positive number";
// More code here if you wish
}
break;
case 3:
{
cout << "You have selected water. Enter the distance:" << endl;
// More code here if you wish
}
break;
case 4:
{
cout << "You have selected air. Enter the distance:" << endl;
// More code here if you wish
}
break;
case 5:
{
cout << "You have selected steel. Enter the distance:" << endl;
// More code here if you wish
}
break;
default :
{
cout << "What the hell dude?" << endl;
}
};
return 0;
}