Time in C++:
Following program calculates time of program execution 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;
}
No comments:
Post a Comment