hi , i am using simple console application and i am asking about the way to make the program depend on time insead of dependng on pressing keys for example, i want siplay the word "Hello.." and after 5 seconds it changes to "World" , to elaborate .. i want system("pause") but depending on time not on keys.
thnx :idea:
dooda man
-3
Newbie Poster
Recommended Answers
Jump to PostSomething like this?
#include <stdio.h> #include <time.h> int main(void) { time_t now, then = time(&now) + 5; if ( now != (time_t)(-1) ) { const char *text[] = {"Hello","World"}; size_t i = 0; for ( ;; ) { printf("\r%s", text[i]); fflush(stdout); if ( ++i >= sizeof text …
All 3 Replies
Dave Sinkula
2,398
long time no c
Team Colleague
kc0arf
68
Posting Virtuoso
Team Colleague
FireNet
64
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.