Hi. I am trying to write a program that asks the user to guess how long it will take for the computer to count to 1 million, then counts to one million and shows then how long it really took. The code I have written so far successfully counts to 1 million and displays it, but i dont know how to implement the time logging aspect. Thank you
#include <iostream>
#include <cstdlib>
usingnamespace std;
int main()
{
int response, counter;
cout<<"Would you like to see your computer count to 1,000,000? If yes, enter a 1, if not enter a 0. Then press enter. " <<endl;
cin>>response;
counter=0;
if(response==1)
{
cout<<"Ok. This will be fun. How long do you think it will take? Enter in seconds and remember your computer can count pretty fast. "<<endl;
while(counter<=1000000)
{
cout<<counter<<endl;
counter++;
}
}
else
cout<<"Okay. Maybe some other time. "<<endl;
return 0;
}