Is there a way to print out the "time" which was used

This is a discussion on Is there a way to print out the "time" which was used within the C++ Programming forums, part of the General Programming Boards category; Hi, I have written a code that allows one to calculate the factorial of a number. Now I would like ...

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Is there a way to print out the "time" which was used

    Hi,


    I have written a code that allows one to calculate the factorial of a number. Now I would like to see how long that my programme takes to calculate a specific number.


    Is there a way to print out that time?




    Thanks.

  2. #2
    Registered User QuestionKing's Avatar
    Join Date
    Jan 2009
    Posts
    68
    Code:
    //  ...
        MyTime.begin = getTime();
        //  ... do some back flips, maybe a swan dive
        MyTime.complete = getTime();
        //  TimeTaken = complete - begin
        std::cout<< TimeTaken<< std::endl;
    //  ...
    Last edited by QuestionKing; 01-25-2010 at 01:36 PM.
    Asking a question you already know the answer to might teach you something you did not know...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Towr of Hanoi move the disc
    By WatchTower in forum C Programming
    Replies: 9
    Last Post: 07-17-2009, 03:48 AM
  2. merging linked lists
    By scwizzo in forum C++ Programming
    Replies: 15
    Last Post: 09-14-2008, 05:07 PM
  3. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 12:13 AM
  4. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 07:26 PM
  5. What kind of programs should I start writing?
    By Macabre in forum C++ Programming
    Replies: 23
    Last Post: 04-12-2003, 08:13 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21