is there any missing initialize variables?
#include <iostream>
using namespace std;
int main()
{
double miles, gallons, mpg;
char repeat;
do {
cout << "Enter the Number of Miles Traveled: ";
cin >> miles;
cout << "Enter Number of Gallons used: ";
cin >> gallons;
mpg = miles / gallons;
cout << "Your MPG is: " << mpg << endl;
cout << "Would like to repeat(Y/N)?: ";
cin >> repeat;
cin.ignore();
cin.get();
}
while (repeat == 'y' || repeat == 'Y');
system("pause");
return 0;
}
Last edited on