Zdravím. Toto sú časti kódu v ktorom mi to vypisuje error "a function definition is not allowed here before { token". Neviem prečo.
int main()
{
srand(time(0));
Intro();
FirstChoice();
ChangeInfo();
cout << "So let's start. Here is the first Stock Market List. Your starting capital is 10 000 dollars. Your goal is 300 000 dollars. It's easy ! \n";
cout << "You will move in weeks. Every 4 weeks you will get list of world's stock market status. Good luck, " << FullName << endl;
StockMarketList();
cout << "Here is your first " << building << ". In the time, you will buy more " << building << "s." << endl;
BasicGameCycle();
return 0;
}
void Intro()
{
double version = 0.1;
cout << "version " << version << endl << endl;
cout << "Welcome to Stock Market Simulator (SMS). Please enjoy. \n" << endl;
cout << "What is your name ? \n";
getline(cin,FullName);
cout << "And your age is ? \n";
cin >> Age;
}
void FirstChoice()
{
cout << "Welcome to SMS " << FullName << endl;
cout << "First you have to choose commodity you wanna trade with. Minerals = easy ----- Fruits = hard \n";
cout << "Minerals : Iron, Copper, Gold, Tin \n";
cout << "Fruits : Apples, Bananas, Lemons \n";
cin >> com;
while(com != "Iron" && com != "Copper" && com != "Gold" && com != "Tin" && com != "Apples" && com != "Bananas" && com != "Lemons")
{
cout << "Please, choose from the list. \n";
cin >> com;
}
cout << "Hmm " << com << " is great choice ! \n";
if (com == "Apples" || com == "Bananas" || com == "Lemons")
{
building = "plantage";
}else{
building = "mine";
}
}
Išlo to v pohode kúsok kódu som zmenil - ani nie v týchto funkciách a zrazu toto...
Kukal som aj na ostatne fora a dozvedel som sa ze sa nema definovat funkcia v inej funkcii.. No nic take tu nie je a stale ten error vypisuje.