How can I use the <ctime>-library to make my program run in one way the first day, another way the second day, and a third way the third way, and then start all over again, for example?
How can I use the <ctime>-library to make my program run in one way the first day, another way the second day, and a third way the third way, and then start all over again, for example?
youll probably need file i/o or code into the program the day of compilation, than calculate the number of days.
The ctime header offers a tm struct which can be used to acquire the current day. You'll have to save the values of this struct before the program ends or what you want will not work, so all you do is read the data that was last saved and if it is the next day, react accordingly. For further information on how to use the tm struct, consult google.
-Prelude
My best code is written with the delete key.
just in case you dont know who the infamous google is: http://google.com
Well I'm not 100% sure of what you're talking about. If you mean to act diffeently each USE, then you just get some of the file I/O going to keep track of number of uses. Then you use % to divide it by three and get the remainder - then you determine which use it is, and then send it off to one of three functions. If you mean literally the 3 days, then you use the date, and then continue as above.