1: /************************************************************************ 2: * CS415 Assignment a11G - main.C 3: * Programmed by 4: * Dan Noe 5: * Steve Anderson 6: * Nick Wawrzynski 7: * 8: * This program accepts batch input consisting of an integer and a set of 9: * times (of the form days:hours:minutes). The integer corresponds to the 10: * number of times being inputted. The program echo prints the times and 11: * then prints the sum of the times in H:MM:SS form. 12: * 13: * Required files: 14: * main.C 15: * Time.h 16: * Time.C (Needs to be compiled and linked with main) 17: * A Makefile is included, but obviously not required to compile. 18: ************************************************************************/ 19: 20: #include <iostream> 21: #include "Time.h" 22: 23: using namespace std; 24: 25: int main() { 26: int numTimes; 27: Time sum; 28: 29: cin >> numTimes; 30: 31: cout << "finding the sum of " << numTimes << " values\n"; 32: cout << "time input\n----------\n"; 33: 34: for (int i=0; i<numTimes; i++) { 35: Time t; 36: 37: t.input(); 38: cout << " "; 39: t.output(); 40: cout << '\n'; 41: 42: sum = sum.add(t); // Add Time t to sum, and place the result in sum. 43: } 44: 45: cout << "\n\nthe sum of the times is "; 46: sum.output(); 47: cout << '\n'; 48: 49: return 0; 50: } 51:
| w | e | b | c | p | p |
|
| |||||