#include #include #include #include #include #include using namespace std; int main() { int sum, count, speed, time ; // Integer variables sum = 0 ; // initializes sum count = 0 ; // initializes count cout << "Speed of the vehicle in mph : " ; cin >> speed ; // speed input cout << "Hours traveled : " ; cin >> time ; // time input cout << endl ; cout << "Hour Distance Traveled" << endl ; cout << "*****************************" << endl ; if (speed >= 0 && time >=1) { for(int i = count ; i < time ; i++) { // initialization ; test expression ; update count++; sum = sum + (speed * i) ; cout << setw(4) << count << setw(15) << speed << endl ; } } if (speed < 0 || time < 1) { cout << "Invalid input!" << endl ; cout << "Speed of the vehicle in mph : " ; cin >> speed ; cout << "Hours traveled : " ; cin >> time ; } cout << "*****************************" << endl ; return 0 ; }