Thread: 2 things at the same time?

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    25

    2 things at the same time?

    can you make 2 things work at he same time? like makeing something like this:

    Code:
    main()
    {
    int min = 0, sec = 0, houre = 0, day = 0;
    while (1){
    
    delay(1000);
    sec++;
    
    if (sec == 60){sec-=60; min+=1;}
    if (min == 60){min-=60; houre+=1;}
    if (houre == 24){houre-=24; day+=1;}
    
    gotoxy(25,15); cout << dag << " : " << time << " : " << min << " : " << sec;
    
    if (sec >= 20) {break;}
    }
    Work while having a question that needs to be answers in under 20 sec? like "whats your name" 20 sec later it scips to next question. is it possible?

  2. #2
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    just to point you in a direction, look up threading... that's all I can help you with there because I don't yet know much about it myself...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Determine the closest departure time
    By Kyeong in forum C Programming
    Replies: 9
    Last Post: 10-07-2008, 08:06 PM
  2. Execution Time - Rijandael encryption
    By gamer4life687 in forum C++ Programming
    Replies: 5
    Last Post: 09-20-2008, 09:25 PM
  3. Doing 2 things at the same time
    By samus250 in forum C Programming
    Replies: 40
    Last Post: 06-20-2008, 02:05 PM
  4. Pthreads performance
    By C_ntua in forum C Programming
    Replies: 42
    Last Post: 06-17-2008, 11:29 AM
  5. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM