Loop that wont keep going!
Code:
#include <iostream.h>
int main()
{
float ag;
float mt;
int redo_calc;
do{
redo_calc=1;
cout<<"Enter the amount of gas used:"
<<endl;
cin>>ag;//ag=amount of gas
cout<<"Gallons of gasoline is: "<<ag
<<endl;
cout<<"Enter miles traveled:"
<<endl;
cin>>mt;//mt=miles traveled
cout<<"Miles traveled is: "<<mt
<<endl;
cout<<"________________"
<<endl;
cout<<"Miles Per Gallon is: "<<ag/mt
<<endl;
cout<<"Enter 1 to do another calculation, or 0 to stop program"
<<endl;
cin>>redo_calc;
break;
}while (redo_calc>0);
return 0;
}
my problem is that i want it to be so that when you insert anything but 1 the process is terminated, but if you insert 1 it keeps going!
<br>
when i press 1 it still stops!