lab3 - cin>> speed>> hour...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <cstdlib> #include <iostream> #include <string> # using namespace std; u int main(){ int n, speed, hour, prevTime, interval=0, total=0; cin >> n ; prevTime=0; while (n != -1){ for (int i= 0; i < n; i++){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cin >> speed >> hour; interval= (speed*(hour-prevTime)); prevTime=hour; total =interval + total; } cout << total << " miles" << endl; cin >> n ; } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online