It wont exit when I type 'n'...
the first loops just fine...its just the ones after that...I have been banging my head agianst it all day.Code:#include "Library.h" #include "Globals.h" #include "Player.h" PLAYER player; void PlayerSetUp(PLAYER* player) { char choice[5], newname[32]; int newstrength, newdexterity, newintelligence, newendurance, newcharm; int roll; cout << "Here we will set your Hero's name and attributes.\n"; cout << "First lets start with your name.\n"; do { cout << "Enter a name, no more than 32 characters long.\n"; cout << ">"; cin.getline(newname, 32, '\n'); cout << "You have entered: " << newname << "\n"; cout << "Is this correct? Y/N\n"; cout << ">"; cin >> choice; cin.ignore(INT_MAX, '\n'); } while (choice[0] == 'n' || choice[0] == 'N'); player->SetName(newname); cout << "Your Hero is now known as: " << player->GetName() << "\n"; Pause(); Clr_Scrn(); cout << "Next we will set " << player->GetName() << "'s" << " attributes.\n"; cout << "You will have 5 attributes.\n"; cout << "Strength\n" << "Intelligence\n" << "Dexterity\n" << "Endurance\n" << "Charm\n"; cout << "Each one has its own advantages, your goal is to find the right combination"; cout << " for you\n" << endl; Pause(); Clr_Scrn(); cout << "We will now start with strength\n"; Pause(); do { int roll = 0; cout << "You get three rolls and three rolls only to choose a value for strength.\n"; cout << "If you have not chosen a value after your third roll, that value will be\n"; cout << " assigned to " << player->GetName() << "'s" << " Strength.\n"; Pause(); cout << "Roll: " << roll + 1 << "\n"; newstrength = (rand() % 10 - 1) + 1; cout << "You rolled a " << newstrength << "\n"; cout << "Do you accept? Y/N\n"; cout << ">"; cin >> choice; roll++; } while ((choice[0] == 'n' || choice[0] == 'N') && roll <= 3); player->SetStrength(newstrength); cout << "Congratulations! " << player->GetName() << "is now: " << player->GetStrength() << endl; Pause(); Clr_Scrn(); cout << "Now Intelligence\n"; Pause(); do { cout << "You get three rolls and three rolls only to choose a value for intelligence.\n"; cout << "If you have not chosen a value after your third roll, that value will be\n"; cout << " assigned to " << player->GetName() << " Intelligence.\n"; Pause(); int roll = 0; cout << "Roll: " << roll + 1 << "\n"; newintelligence = (rand() % 10 - 1) + 1; cout << "You rolled a " << newintelligence << "\n"; cout << "Do you accept? Y/N\n"; cout << ">"; cin >> choice; roll++; } while ((choice[0] == 'n' || choice[0] == 'N') && roll <= 3); player->SetIntelligence(newintelligence); cout << "Congratulations! " << player->GetIntelligence() << "is now: " << player->GetIntelligence() << endl; Pause(); Clr_Scrn(); cout << "Now Endurance\n"; Pause(); do { cout << "You get three rolls and three rolls only to choose a value for endurance.\n"; cout << "If you have not chosen a value after your third roll, that value will be\n"; cout << " assigned to " << player->GetName() << " Endurance.\n"; Pause(); int roll = 0; cout << "Roll: " << roll + 1 << "\n"; newendurance = (rand() % 10 - 1) + 1; cout << "You rolled a " << newendurance << "\n"; cout << "Do you accept? Y/N\n"; cout << ">"; cin >> choice; roll++; } while ((choice[0] == 'n' || choice[0] == 'N') && roll < 3); player->SetEndurance(newendurance); cout << "Congratulations! " << player->GetEndurance() << "is now: " << player->GetEndurance() << endl; Pause(); Clr_Scrn(); cout << "Finally Charm\n"; Pause(); do { cout << "You get three rolls and three rolls only to choose a value for charm.\n"; cout << "If you have not chosen a value after your third roll, that value will be\n"; cout << " assigned to " << player->GetName() << " Charm.\n"; Pause(); int roll = 0; cout << "Roll: " << roll + 1 << "\n"; newcharm = (rand() % 10 - 1) + 1; cout << "You rolled a " << newcharm << "\n"; cout << "Do you accept? Y/N\n"; cout << ">"; cin >> choice; roll++; } while ((choice[0] == 'n' || choice[0] == 'N') && roll < 3); player->SetCharm(newcharm); cout << "Congratulations! " << player->GetCharm() << "is now: " << player->GetCharm() << endl; Pause(); Clr_Scrn(); }



LinkBack URL
About LinkBacks



