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)
{
cout<<"You are right!"<<endl;
}
else
{
cout<<"You are wrong!"<<endl;
}
time(&end);
}
dif = difftime (end,start);
}while (dif <60);
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)
{
cout<<"You are right!"<<endl;
}
else
{
cout<<"You are wrong!"<<endl;
}
time(&end);
}
dif = difftime (end,start);
}while (dif <60);
Comment