473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Time simulation

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
2 1434
b1randon
171 Expert 100+
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
while(!kbhit())
{
cout<<i<<".00"<<endl;
i++%24;
sleep(1);
}


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

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

Similar topics

2
by: Samir Patel | last post by:
For last couple of weeks, I was doing lot of research on various simulation libraries. Only one I find in python is http://simpy.sourceforge.net. It is very powerful, but it seems that it does not...
0
by: Titi Anggono | last post by:
Here is my code in cgi. ============================= #!/usr/bin/python print "Content-Type:text/plain\n\n" # python code here (create a simulation or graphics)...
1
by: Daryl Shanley | last post by:
I have some c code that writes results directly to a file as they're produced during a simulation. I want to modify the code to write directly to a postgres database using libpq. I think I could...
11
by: Kovan Akrei | last post by:
Hi, I wonder if there are any others ways (mehtods, properties) to get the system time than DateTime.Now.Ticks Regards from Kovan...
4
by: Richard Blackwood | last post by:
Hello all. I have a few questions about simulation programming. One, do all programmers know to how to code a simulation? By simulation I mean a model of real world relationships (i.e. like...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.