i need your help to write this program ..

anyone can help me to write this program please ..

Write a program that prompts the user to input the number of seconds, minutes, and hours.
The program then outputs the total time in seconds.

thanx alot .
Please note, that this is not a homework site. We won't do your homework for you. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.

We didn't see your attemts to solve this problem youself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again. As it is impossible to find deriviative of function without knowledge in ariphmetics, you cannot do more complex tasks in programming without clear understanding of basics
i did the program but i want to make sure if it is right or not ..

this is my work ..

#inculde <iostream>

using namespace std;

int main ()

{

int seconds ;

int minute ;

int hour ;

int total ;

cout << "enter the value in seconds"<<endl;

cin>> total ;

hour = total/3600;
hour=total%3600;

minute=total/60;
minute=total%60;

;seconds= total/60;
;seconds=seconds%60;

cout<<hour<<":"<<minute<<":"<<seconds<<endl;

return 0;

}
You did it backward: you need to take hours, minutes and seconds separately and then output total number in seconds.
do you mean instead of writing

int seconds ;
int minute;
int hour ;
int total ;

i should write

int hour ;
int minute ;
int seconds;
int total ;

??
and what about the other steps .. are they true ?
Topic archived. No new replies allowed.