Where to put this

Alright in my game there will be a shop but depending how far in the game you are the shop will have different items i have no problem setting this up but where can i place the shop in the code where it takes the latest changes



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//example 1
 int y = 0;
int x = 0;
if (y = 99)
{
shop:
cout << "Welcome to the shop how can we help you";
if ( x = 1)
{
cout << We have these in stock";
}
else 
{
}
}
else
{
} 

cout << "this way to shop";
x = 1;
goto shop; 


Now my problem is when i use goto it doesn't remember that x is 1 so it wont change anything is there any place i can put the shop (not in the code) where it will remember the last numbers
Last edited on
if ( x = 1) should be if ( x == 1)

if (y = 99) same problem
Thanks sorry dumb of me all my other ones are like that anyways sorry for wasting your time
Topic archived. No new replies allowed.