Can somebody help me with this.Code:#include<conio.h>
#include<iostream>
using namespace std;
int opcio1();
int opcio2();
void main()
{
char sel;
do{
sel=getch();
}while((sel<'1' || sel>'2')&&sel!=27);
switch(sel){
case '1':
opcio1();
break;
case '2':
opcio2();
break;
case 27:
return;
}
int opcio1()
{
char sentence[100];
cout<<"Ask what you should do in the market today!"<<endl;
cin.getline (sentence,100);
cin.ignore();
int theNumber;
theNumber = 1 + rand() % 3;
switch (theNumber)
{
case 1:
cout<<"You should definetly buy!"<<endl;
break;
case 2:
cout<<"Sell!Sell!Sell!"<<endl;
break;
case 3:
cout<<"Heck if I know. Go ask your brocker."<<endl;
break;
default:
break;
}
int opcio2()
{
char sentence[100];
cout<<"Do you feel lucky today!"<<endl;
cin.getline (sentence,100);
cin.ignore();
int theNumbers;
theNumbers = 1 + rand() % 4;
if (theNumbers = 1)
{
cout<<"No way!"<<endl;
}
if (theNumbers = 2)
{
cout<<"Most Likely, yes!"<<endl;
}
if (theNumbers = 3)
{
cout<<"Try again tomorrow!"<<endl;
}
if (theNumbers = 4)
{
cout<<"Yes. I belive so!"<<endl;
}
}
system("PAUSE");
return 0;
}
At the beginning I have menu so the user can pick what function to enter.
But I have errors with getch, and with the definition of functions. Can somebody help me