Help

Mar 29, 2015 at 12:20pm

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?????
Mar 29, 2015 at 12:23pm
could you show us what you did?
Mar 29, 2015 at 12:33pm
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;

}
Mar 29, 2015 at 12:40pm
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 Mar 29, 2015 at 12:40pm
Mar 29, 2015 at 12:43pm
cout<<"\nThe difference is "<< Ct- Ot; // should be Ot - Ct
Topic archived. No new replies allowed.