This code is supposed to play a game of craps while asking for the users name the first time, checking if the name exists, otherwise just play the game until all money is lost then asking user if it would like to save game. I only have problems with the reading writing part, any ideas?
using std::cout;
using std::cin;
using namespace std;
int i, j,k,scores,point; //dice1, dice2, scores,
char r;
int scores = 1000;
string Name;
ifstream Names("SavedNames.txt")
char YN;
cout << "What is your name"; //search for file at beginning of game once
cin >> Name;
cout << "would you like to save score and name. Y/N??";
cin >> YN;
if(YN == 'Y' || YN == 'y'){
int ExistingGame();
int PlayGame();
int PlayGame()
{
do {
int i =(rand()%(6-1+1)+1);
int j =(rand()%(6-1+1)+1);
k = i +j;
if (k == 12 || k == 2 || k ==3){ //get these numbers you lose
scores -=100;
return menu; //return to menu
cout << "You lost!";
else if (k == 7 || k == 11) //get these numbers you win
scores +=100;
cout << "You won..."
return menu;
else
point = k;
do {
int i = (rand()%(6-1+1)+1); //roll again until point or 7
int j = (rand()%(6-1+1)+1);
k = i + j;
if (k == point) //got point you win
scores +=100;
cout <<"You won!";
return menu;
if ((k%7) == 0) //got 7 you lose
scores -100;
cout <<"You lost!";
return menu; //return to menu
while(k != 0)