Ok, I have a small game I am making, and I used a old save/load system I found on these forums. But unfortunately, it doesn't work. It saves fine, but it doesn't load and re assign the integers. I only want it to load the integers from the file, no strings or any other data type. Here is my code: (sorry for posting all of it)
Ok sorry I edited the code to show only the variables and save/load system. Although I did say in my initial post that the load system didn't work, specifically it doesn't load any of the integers and assign them correctly into the program. I'm asking for help on how to fix it.
Sorry I don't think you understood the question... My load system isn't working, ans1 isn't part of of the load function and it works fine, I was looking for help on how to load integers from a file. And yes, I know goto is bad but I honestly don't care. All this code is actually in loops I was just being lazy for testing purposes.
1.-You used label "menu" with goto, but didn't define it.
2.-You lack a } at the end of the program.
3.-What Volatile Pulse says. Seems like if the menu is incomplete, and the if/elses would be in a singleplayer save menu which lacks where to get there from.
4.-I would remove the name of the information you put in the text file, maybe it's reading the name instead of the value, try: dice_Save <<running<<endl;
Instead of: dice_Save <<"RUN: "<<running<<endl;
Ok I see what you guys are saying, the first poster asked that I only give the code you needed. I don't have access to my computer so I just used my iPhone to edit the message and I didn't put the code in separate tags. I have about 200 more lines of code that actually go with this program. The if (ans1 == x) works fine and that's how I learned how to do it. Again, I only gave you the code you need.
4.-I would remove the name of the information you put in the text file, maybe it's reading the name instead of the value, try: dice_Save <<running<<endl;
Instead of: dice_Save <<"RUN: "<<running<<endl;