By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,435 Members | 1,499 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,435 IT Pros & Developers. It's quick & easy.

Time simulation

P: 9
I have a problem.I want to make a program that simulates hours into seconds.For example if i run the program when time is 8.00 , in every second passing ,i want to be printed in the screen:
9.00 /*when it prints 9.00 after a second it prints 10.00 and after a second*/
10.00 /*it prints 11 ....... */
11.00
.....
....
....

.I would apreciate any help
Dec 20 '06 #1
Share this Question
Share on Google+
2 Replies


b1randon
Expert 100+
P: 171
I have a problem.I want to make a program that simulates hours into seconds.For example if i run the program when time is 8.00 , in every second passing ,i want to be printed in the screen:
9.00 /*when it prints 9.00 after a second it prints 10.00 and after a second*/
10.00 /*it prints 11 ....... */
11.00
.....
....
....

.I would apreciate any help
Try writing something first. You're going to want to use a while loop with a condition that won't fail (like while(true)) and then in the loop you'll want to increment a variable, print it, then sleep.
Dec 20 '06 #2

P: 2
while(!kbhit())
{
cout<<i<<".00"<<endl;
i++%24;
sleep(1);
}


This might help but its very primitive.
Dec 21 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.