Help


Please help me to solve the C++ problem to find out
the difference between 2 hours???(hh:min)
for example:
hour 1 : 2:59
hour 2 : 1:29


the difference is 1:30 hrs.

can you make this program?????
could you show us what you did?
I am a neophyte to Programming world...


#include<iostream>
using namespace std;
int main()
{
int Ot, Ct;
cout<<"Enter the Opening time: ";
cin>>Ot;
cout<<"\nEnter the Closing time: ";
cin>>Ct;
cout<<"\nThe difference is "<< Ct- Ot;

return 0;

}
take two variables for a time (for an hour and for a minute).. multiply hour by 60 to get minute and add it to minute.

Do this for second and then subtract and take the division and remainder(mod) and show it.....

Try this If you have doubt feel free to ask it :D


btw please use code tags....
Last edited on
cout<<"\nThe difference is "<< Ct- Ot; // should be Ot - Ct
Topic archived. No new replies allowed.