You need an int variable I believe. You have a cin >> pergal; but no place to store that information. Then if you want to output it you need another extraction. So after you declare an int variable for pergal,
cout<< "Price per gallon at gas station";
cin >> pergal;
cout << "The price is: " << pergal << "for every gallon" <<endl;
#include <iostream>
usingnamespace std;
int main()
{
int pergal;
cin >> pergal;
//input the price here, you can throw in a message if you want...
for (int counter = 0; counter < 3; counter++) {
cout << "Price per gallon at a gas station: \n";
cout << "The price is " << pergal << " for a gallon \n";
}
system("PAUSE");
return 0;
}
The other problem is you're asking for the price 4 times and storing it in the same location.
Each iteration through the loop overlays the previous value.