//Tiffany Sallee
// Lab8
// Calculate distance using speed & time
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
//declare variables
int speed;
int time;
int distance;
int hour;
// enter speed, do not accept 0 or negatives
do
{
cout << "What is the speed of the vehicle (mph)? ";
cin >> speed;
} while (speed < 1);
// enter time, do not accept 0 or negatives
do
{
cout << "How many hours has the vehicle travelled? ";
cin >> time;
}while (time < 1);
// distance formula
distance = speed * hour;
// calculate with repeat for output by hour
for (hour = 1; hour <= time; hour = hour + 1)
cout << "After Hour " << hour << " you travelled " << distance << " miles.\n";
system("pause");
return 0;
}