Code:
int city(string c, int s, int ag, int intel)
{
int direction = 0;
int times;
int fin = 0;
string *dirs;
while (fin == 0)
{
int choice;
cout << "What do you want to do: " << endl;
cout << "1. Gain strenght\n" << "2. Gain agility\n" << "3. Gain intelligence\n" << "4. Leave city\n";
cout << "Choice: "; cin >> choice;
switch(choice)
{
case 1:
cout << "You have gained 1 strength!" << endl;
s++;
times++;
break;
case 2:
cout << "You have gained 1 agility!" << endl;
ag++;
times++;
break;
case 3:
cout << "You took lessons! Intelligence +1!" << endl;
intel++;
times++;
break;
case 4:
fin++;
break;
default:
cout << "Wrong input!" << endl;
break;
}
}
if(c == "Rivendell")
{
dirs[0] = "Amon Hen";
dirs[1] = "Ashenvale";
dirs[2] = "Mechanica";
dirs[3] = "Lok-tar";
}
cout << "In which direction do you want to leave?\n1." << dirs[0] << "\n2. " << dirs[1] << "\n3. " << dirs[2] << "\n4. " << dirs[3] << endl;
cin >> direction;
return direction;
}
Whole function "city".