Im suppose to create a program in which i ask user for MPH and time traveled.
For example, if a train travels 40 miles-per-hour for three hours, the distance traveled is 120 miles. and display.
Hour Distance Traveled
1 40
2 80
3 120
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
double vs; // vehicle speed
double hours;
double S_H;
cout << " Enter the speed of the vehicle (MPH): " << endl;
cin >> vs;
cout << "Enter the period of time the vehicle has traveled (hours): " << endl;
cin >> hours;
S_H = hours * vs
int i;
for (i = vs; i < S_H; i++)
{
cout << "Hours Distance Travalled" << endl;
cout << i << " " <<endl;
}
double vs; // vehicle speed
double hours;
double S_H;
cout << " Enter the speed of the vehicle (MPH): " << endl;
cin >> vs;
cout << "Enter the period of time the vehicle has traveled (hours): " << endl;
cin >> hours;
S_H = hours * vs ; //<----
int i;
for (i = vs; i < S_H; i++)
{
cout << "Hours Distance Travalled" << endl;
cout << i << " " <<endl;
}