Im making a text based game and I was going to add in potions into my game. Instead of just adding in all the functions dealing with the potions, I wanted to make a small program that had just a shop() in it. In the shop(), you could buy a potion and it would take you to an addPotion(). But, even though it works in my main game, my smaller one wont open up the shop. And I cant seem to figure out why.
This is the code to my main(), which runs a small intro(), and then a begin(). In the begin function you pick to create a character or quit. After doing the createChar(), it brings you back to main()(here u can pick Shop or quit). Then thats where you select the shop(). But instead of loading the shop(), it loads the main() again(where u can pick shop or quit)
Code:
int main(){
srand(time(NULL));
intro();
Sleep(500);
while(strcmp(chr.name,"") == 0 ){
begin();
}
while (1) {
cout << "\n\n What do you want to do? \n\n";
cout << "1. Shop\n";
cout << "2. Quit\n\n";
cin >> choice2;
switch(choice2){
case 1:
void Shop();
break;
case 2:
exit(0);
default:
cout << "\n\n Wrong....\n\n";
}
}
}
Ive tried to write it as many ways as I know, but nothing seems to work. Can anyone tell me why?