1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
#include <iostream>
using namespace std;
void timeone (int fhr, int fmin, int fsec, char col);
void timetwo (int shr, int smin, int ssec, char col);
int main ()
{
int fhr, fmin, fsec;
int shr, smin, ssec;
int diffhr, diffmin, diffsec;
char col;
cout << "Enter first time as hr:min:sec." << endl;
cin >> fhr >> col >> fmin >> col >> fsec;
while ( cin >> fhr >> col >> fmin >> col >> fsec)
{
void timeone (int fhr, int fmin, int fsec, char col);
void timetwo (int shr, int smin, int ssec, char col);
cout << "Start time: " << fhr << col << fmin << col << fsec << endl;
cout << "Final time: " << shr << col << smin << col << ssec << endl;
diffhr = shr - fhr;
diffmin = smin - fmin;
diffsec = ssec - fsec;
cout << diffhr << col << diffmin << col << diffsec << endl;
return 0;
}
void timeone (int fhr, int fmin, int fsec, char col);
{
cout << "Enter start time as: hr:min:sec." << endl;
cin >> fhr >> col >> fmin >> col >> fsec;
if (fhr > 24 || fmin > 60 || fsec || 60)
{
cout << "Invalid time." << endl;
}
else
{
}
return fhr, fmin, fsec;
}
void timetwo (int shr, int smin, int ssec, char col);
{
cout << "Enter final time." << endl;
cin >> shr >> col >> fmin >> col >> fsec;
if (shr > 24 || smin > 60 || ssec > 60)
{
cout << "Invalid time." << endl;
}
else
{
}
return shr, smin, fsec;
}
}
|