After analyzing all the given suggestions, I came up with this code:
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
srand((unsigned )time(0));
time_t start,end;
int random_integer4 , random_integer5 , adv_operation, adv_value, random_integer6 ;
int adv_ans;
double dif_total=0.00;...
User Profile
Collapse
-
Yapy replied to How do I stop a loop after 60 seconds by using the difftime(time_t, time_t) functionin CHow do i loop the program then? If i use do while loop, what is the condition that i should use? thanks
if(difftime(end ,start)<60)
{
do
{
cout<<"What's your name?"<<endl;
cin>>name;
}while (condition)
}Leave a comment:
-
Yapy started a topic How do I stop a loop after 60 seconds by using the difftime(time_t, time_t) functionin CHow do I stop a loop after 60 seconds by using the difftime(time_t, time_t) function
This is part of the program I wrote. I need to use the
difftime(time_t , time_t) function but I am not sure of how to use it.
do {
switch(operatio n)
{
case 1:
answer=random_i nteger1 + random_integer2 ;
time(&start);
cout << random_integer1 << "+" << random_integer2 << endl;
cin >>value;
if (answer == value)...
No activity results to display
Show More
Leave a comment: