Thread: Clock

  1. #1


    This code does not work

    #include <iostream>
    #include <time.h>
    #include <conio.h>

    using namespace std;

    int main()
    time_t hold_t;
    hold_t = time(NULL);
    for(; ; )
    cout << "\nThe time is " << hold_t << endl;
    return 0;

    it says clrscr(); is an undeclared identifier. This simple console application should work fine, but I dont' knwo why it doenst.
    Last edited by Shadow12345; 05-12-2002 at 12:49 PM.

  2. #2
    Evil Member
    Join Date
    Jan 2002
    <conio.h> isn't standard. What compiler are you using?

    Also, you don't update hold_t in your loop. It would just display the same time again and again.

    And it would be hard to read, b/c clrscr() or any similiar func would cause a flickering effect if you put it in an unrestricted for loop.

  3. #3
    if the clrscr() is your problem, you could try system("cls"); that usually works for me.

  4. #4
    Registered User OxYgEn-22's Avatar
    Join Date
    Apr 2002
    ahh, system functions... so slow.. so useful
    Is that air you're breathing?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical Error in Clock program
    By SVXX in forum C++ Programming
    Replies: 0
    Last Post: 05-10-2009, 12:12 AM
  2. Outside influences on clock cycles? (clock_t)
    By rsgysel in forum C Programming
    Replies: 4
    Last Post: 01-08-2009, 06:15 PM
  3. Clock Troubles
    By _Nate_ in forum C Programming
    Replies: 22
    Last Post: 06-19-2008, 05:15 AM
  4. clock program
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 10:12 PM
  5. System clock
    By bazzano in forum C Programming
    Replies: 10
    Last Post: 03-27-2007, 10:37 AM