access97to2000
Programmer
Hi,
I have a question regarding input checking.
I want the user to enter 10 float type numbers. (10 maximum) he can stop entering the numbers instead of entering all 10 numbers by typing "End". I am taking n as float
how can I check if the entered value is "end" ? I am attaching the program down.
Thanks for your help
**************************************
float n;
cout << "Hi Start Inputting the values (10# Max - Enter 'end' to End) \n\n\n" ;
for (i=0;i<10;i++)
{
cout << "Enter No " << i+1 << " : " << " " ;
cin >> n;
if (n == "end"
{
cout << "Do you want to end enterning the numbers?(Y/N) ? ";
cin >> ans;
}
I have a question regarding input checking.
I want the user to enter 10 float type numbers. (10 maximum) he can stop entering the numbers instead of entering all 10 numbers by typing "End". I am taking n as float
how can I check if the entered value is "end" ? I am attaching the program down.
Thanks for your help
**************************************
float n;
cout << "Hi Start Inputting the values (10# Max - Enter 'end' to End) \n\n\n" ;
for (i=0;i<10;i++)
{
cout << "Enter No " << i+1 << " : " << " " ;
cin >> n;
if (n == "end"
{
cout << "Do you want to end enterning the numbers?(Y/N) ? ";
cin >> ans;
}