Search This Blog

Need help in assignment?

C++ Programming Developer

Calculate Time of program C++

Time in C++:
Following program calculates time of program execution in C++:

 #include <iostream>  
 #include <ctime>  
 #include <windows.h>  
 using namespace std;  
   
 int main(){  
      double start_time = clock();  
      Beep(500,1000); //BEEP FOR 1 SECOND will be produced. //YOUR CODE HERE.  
      double end_time = clock();  
        
   
      double time_taken = end_time - start_time;  
      double time_taken_in_seconds = time_taken/CLOCKS_PER_SEC;  
   
      cout << "Time taken during program execution is " << time_taken_in_seconds << " Second(s)"<< endl;  
        
      return 0;  
 }  
"Don't let anyone ever make you feel like you don't deserve what you want."