#include #include #include using namespace std; int myStoi(string str){ stringstream aas(str); int N; aas<>N; return N; } int main(){ int n,counter=0; cout << "Enter n? "; cin >> n; cout << "Enter hours worked? "; for (int i = 0; i < n; ++i){ string temp; cin >> temp; counter += myStoi(temp.substr(0,2))*60 + myStoi(temp.substr(3)); } cout << counter << " min = "; if (counter/60 > 0){ cout << counter/60 << " h"; if (counter%60 != 0){ cout << " " << counter%60 << " min\n"; } } else { cout << counter%60 << " min\n"; } }