Поскольку вы новичок в программировании, хорошим местом для сохранения данных для последующего использования является запись данных в текстовый файл, а затем загрузка этих данных из файла при последующем запуске. Это даст вам хороший опыт ввода/вывода файлов (что полезно знать для любого языка программирования, а не только для C++). Существует хороший учебник на файл ввод/вывод здесь стоит проверить в качестве отправной точки: http://www.cplusplus.com/doc/tutorial/files/
Для основной демонстрации, скажем, вы хотите, чтобы сохранить имя и номер игрока пунктов:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main() {
// player information we want to write out
string name = "player1";
int points = 1234;
int turn = 10;
ofstream fout; // I use fout as shorthand for "File OUTput"
fout.open("file1.txt"); // opens a file named 'file1.txt' for writing
// write the data to the file
fout << name << ' ' << points << ' ' << turn << endl;
fout.close(); // don't forget to close the file output stream
// now let's open the file to read in the data
ifstream fin; // I use fin as shorthand for "File INput"
fin.open("file1.txt");
string namereadin = "";
int pointsreadin = -1;
int turnreadin = -1;
// now let's read in the data. Since we know what order we wrote the info
// to file in, we can read it in using that same order
fin >> namereadin >> pointsreadin >> turnreadin;
// now just to show that we read the input correctly, let's output it to the screen
cout << namereadin << " " << pointsreadin << " " << turnreadin << endl;
}
В конечном итоге вы захотите использовать блок try-catch для обработки ошибок.
С переменными. – erip
'int a; std :: cin >> a; ' – user463035818
Вы имеете в виду выписать файл save? – BeyelerStudios