Initializing Variables

Hey i'm currently taking a c++ class and had to do a homework assignment where i calculate the miles per gallon with the given miles and gallons used. After I submitted my code to my proff, he said that I forgot to initialize my variables. What does that mean and what is it suppose to look like?

MY CODE:



#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;
}
Topic archived. No new replies allowed.