Hi, im pretty new to C++, Ive just latly been getting into it. I want to make a simple text game. All I need to know is how to save/load variables perhaps in a txt file? I tryed some source code from a tutorial that worked to an extent but was realy sloppy. I included most of the code for my prog, just took out a few unneed lines. Thanks!
Code:
#include <iostream.h>
#include <conio.h>
int choice;
void main() {
cout << "Welcome to Monster .Net!!!\n";
cout << "1. Fight 2. Eat 3. Sleep 4. Stats \n";
cout << "5. Move North 6. Move South 7. Move East 8. Move West\n";
cout << "11. Save 12. Quit\n";
cin >> choice;
while ( choice == 1 || 2 || 3 )
{
switch ( choice )
{
case 1:
cout << "Hahaha\n";
cout << "\n";
cout << "\n";
break;
case 2:
cout << "Hahaha\n";
break;
case 3:
cout << "Hahaha\n";
break;
default:
cout << "\n";
main();
}
main();
}
}