When i try to run my program i get an infinate loop and i dont understand why
Code:#include <fstream> #include <iostream> #include <string> using namespace std; int main() { string PlayerFullName, CharacterName, Class, Race, Password, stop, Racials; int hp = 0, xp = 0, mana = 0, sp = 15, SwitchRace; system("color 0a"); system("cls"); cout<<"\nEnter the DM Password or you shall be smited: "; getline(cin, Password, '\n'); if (Password == "god") { system("cls"); cout<<"\n\nyou truly are an evil gm\n\n Would you like to create a Player?(yes or no): "; cin>>stop; while (stop == "yes") { cout<<"Enter Player Full Name: "; getline(cin, PlayerFullName, '\n'); cin.get(); cout<<"\nEnter Character Name: "; getline(cin, CharacterName, '\n'); cin.get(); cout<<"\nEnter Class: "; getline(cin, Class, '\n'); cin.get(); cout<<"\nplayable races\n Good Aligned\n________\n(1)Human\n(2)Gnome\n(3)Halfling\n(4)Dwarf\n(5)Elf\n(6)Animal Folk\n(7)Seelie Fae\n\nEvil Aligned\n________\n(1)Human\n(8)Kobold\n(9)Goblin\n(10)Orc\n(11)Dark Elf\n(6)Animal Folk\n(12)Unseelie Fae \ntype the numbers that are next to the race name, to select that race.\n\nEnter Race: "; cin>>SwitchRace; cin.ignore(); switch ( SwitchRace ) { case 1: cout<<"\n you chose Human +2 ability points"; Race = "Human"; sp = sp + 2; break; case 2: cout<<"\n you chose Gnome 1/2 cost craft"; Race = "Gnome"; Racials = "1/2 cost craft"; break; case 3: cout<<"\n you chose Halfling 1/2 cost thrown weapons"; Race = "Halfling"; Racials = "1/2 cost thrown weapons"; break; case 4: cout<<"\n you chose Dwarf +2 hp"; Race = "Dwarf"; hp = hp + 2; sp = 12; break; case 5: cout<<"\n you chose Elf +2 mana"; Race = "Elf"; mana += 2; sp = 12; break; case 6: cout<<"\n you chose Animal Folk"; Race = "Animal Folk"; Racials = "See Dm"; break; case 7: cout<<"\n you chose Seelie Fae +2 mana"; Race = "Seelie Fae"; mana += 2; sp = 12; break; case 8: cout<<"\n you chose Kobold 1/2 cost trap making"; Race = "Kobold"; Racials = "1/2 cost trap making"; break; case 9: cout<<"\n you chose Goblin 1/2 Cost Spear"; Race = "Goblin"; Racials = "1/2 Cost Spear"; break; case 10: cout<<"\n you chose Orc 1/2 Cost Two-Handed"; Race = "Orc"; Racials = "1/2 Cost Two-Handed"; break; case 11: cout<<"\n you chose Dark Elf +2 mana"; Race = "Dark Elf"; mana += 2; sp = 12; break; case 12: cout<<"\n you chose Unseelie Fae +2 mana"; Race = "Unseelie Fae"; mana += 2; sp = 12; break; default: cout<<"\n that is not a Race! try again: "; cin>>SwitchRace; cin.ignore(); break; } cout<<"\nyour player is.... \n \n \n\n\n\n\n"; cout<<"Player Name: "<<PlayerFullName<<"\nCharacter Name: "<<CharacterName<<"\nclass: "<<Class<<"\nRace: "<<Race<<"\nHitpoints: "<<hp<<"\nExperience: "<<xp<<"\nMana: "<<mana<<"\nSkill Points: "<<sp; string filename = PlayerFullName + ".txt"; ofstream Playerfile ( filename.c_str() ); Playerfile<<"Player Name: "<<PlayerFullName<<"\nCharacter Name: "<<CharacterName<<"\nclass: "<<Class<<"\nRace: "<<Race<<"\nHitpoints: "<<hp<<"\nExperience: "<<xp<<"\nMana: "<<mana<<"\nSkill Points: "<<sp; cout<<"\nDo you want to create another character? (yes or no): "; cin>>stop; cin.ignore(); } } if (Password != "god") { } cout<<"\nGoodbye"; cin.get(); return 0; }



LinkBack URL
About LinkBacks


