Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have recieved an error about the (GetTickCount()); being unidentified, can you

ID: 3531175 • Letter: I

Question

I have recieved an error about the (GetTickCount()); being unidentified, can you help solve this problem?

#include <iostream>
#include <cstdlib>
#include <string>
#include <conio.h>
using namespace std;
int beenhere=0;
int again();
int main()
{
string question;
int answer;
if (beenhere != 0)
{
cout << "What is your question now? ";
}

if (beenhere == 0)
{
cout << "Welcome to the fortune teller! What is your question? ";
beenhere++;
}
cin >> question;
srand(GetTickCount());
answer = rand()%7;
switch(answer)
{
case 0:
cout << "Yes ";
break;
case 1:
cout << "No ";
break;
case 2:
cout << "Most Likely ";
break;
case 3:
cout << "It is Certain ";
break;
case 4:
cout << "Don't Count on it ";
break;
case 5:
cout << "Ask Again Later ";
break;
case 6:
cout << "Outlook Good ";
break;
}
getch();
return again();
}
int again()
{
string another;
cout << "Would you like to ask another question? ";
cin >> another;
if (another[0] == 'y' || another[0] == 'Y')
{
system ("cls");
return main();
}
if (another[0] == 'n' || another[0] == 'N')
return 0;
else
{
system("cls");
return again();
}
}

Explanation / Answer

// i have modified it as you question please run it and hopefully rate me 5 star first please thanks


#include <iostream>
#include <cstdlib>
#include <string>
//#include <conio.h> // don't use conio some compiler does not support it
using namespace std;
int beenhere=0;

int main()
{
string question;
int answer;
if (beenhere != 0)
{
cout << "What is your question now? ";
}

if (beenhere == 0)
{
cout << "Welcome to the fortune teller! What is your question? ";
beenhere++;
}
do{
cin >> question;
srand(GetTickCount());
answer = rand()%7;
switch(answer)
{
case 0:
cout << "Yes ";
break;
case 1:
cout << "No ";
break;
case 2:
cout << "Most Likely ";
break;
case 3:
cout << "It is Certain ";
break;
case 4:
cout << "Don't Count on it ";
break;
case 5:
cout << "Ask Again Later ";
break;
case 6:
cout << "Outlook Good ";
break;
}
char another;
cout << "Would you like to ask another question? ";
cin >> another;
}while(another !='n' || another !='N')
//getch(); // don't use method defined in conio header file
return 0;
}