For some reason there is a syntax error at line 117 before +=.
Help!!!Code://My Role-Playing Game #include <iostream.h> #include <string> int main() { float hp; float dp; float mp; float fp; float maxhp; float maxmp; std::string weapon; std::string attack; cout << "What is your name?" << endl; std::string name; cin >> name; cout << "What is your race?" << endl; cout << "Elf, Human, Orc" << endl; std::string race; cin >> race; cout << "Hello, " << name <<". Your race is " << race << endl; if(race=="Elf") { maxhp, hp=105; dp=20; maxmp, mp=45; fp=35; weapon="Bow"; } if(race=="Human") { maxhp, hp=115; dp=23; maxmp, mp=15; fp=30; weapon="Sword"; } if(race=="Orc") { maxhp, hp=76; dp=30; maxmp, mp=19; fp=42; weapon="Axe"; } cout << "Your weapon is " << weapon << endl; cout << "You are in the middle of a deep forest when suddenly you are attacked by a wild boar. Do you... " << endl; float enehp=40; float enedp=5; while(enehp >= 1) { cout << "Attack, Run" << endl; float hurtene; cin >> attack; if(attack == "Attack") { hurtene = fp-enedp; enehp -= hurtene; cout << "You did " << hurtene << " damage!!!" << endl; } if(attack == "Run") { cout << "You can't run from the battle!!!" << endl; } } cout << "You killed the boar!" << endl; cout << "You found boar meat!!!" << endl; float boarmeat; boarmeat+=1; cout << "Mother: " << name << "!!!" << endl; cout << "Mother: It's dinner time!!!" << endl; cout << "You run to your house with the boar meat hanging over your shoulder" << endl; cout << "Father: It's high time you learned to fight." << endl; cout << name << ": If you say so." << endl; cout << "A golem appeared!" << endl; cout << "Father: First, choose an attack. Your choices are attack, magic, and run." << endl; enehp=65; enedp=10; float enefp; enefp=40; float hurtene; while(enehp >= 1) { battlestart: cin >> attack; if(attack == "Attack") { hurtene=fp-enedp; enehp-=hurtene; cout << "You did " << hurtene << " damage!" << endl; } if(attack == "Magic") { cout << "Father: You can't yet use magic!" << endl; cout << "Father: Pick something else!" << endl; goto battlestart; } if(attack == "Run") { cout << "Father: Don't run! Not after you've come this far!" << endl; cout << "Pick something else!" << endl; goto battlestart; } //enemy's turn float hurtyou; hurtyou=enefp-dp; hp-=hurtyou; cout << "The enemy did " << hurtyou << " damage!!!" << endl; if(hp <= 0) { cout << "You died" << endl; cin.ignore(); cin.get(); return 0; } } int exp+=25; cout << "You gained 25 exp!" << endl; cout << "Father: You see, " << name << ", when you destroy a monster, you will gain experience. If your experience grows to more than 100, you will gain a level and stats. " << endl; cout << "Now, go to bed and it will all be fine. " << endl; cout << "You went to bed" << endl; hp=maxhp; mp=maxmp; cout << "Mother: " << name << "!!!" << endl; cout << "You wake up and yell JUST A MINUTE!!!" << endl; cout << "You reach under your pillow and feel a spherical object." << endl; cout << "As you pull it out, you realize that it is a magical orb!" << endl; cout << "You learned [Glacier Ice]!!!" << endl; int glacierice=1; cout << name << "!!!. Hurry up or you'll be late for baseball practice!!!" << endl; cout << name << ": Mom! " << race << "s don't play baseball!" << endl; cout << "As you head downstairs, a pigmy toad flies out the window and attacks you. Do you..." << endl; enehp=120; enefp=30; enedp=15; while(enehp >= 1) { cout << "Attack, Magic, Run" << endl; std::string attack; cin >> attack; if(attack=="Attack") { hurtene=fp-enedp; enehp-=hurtene; cout << "You did " << hurtene << " damage!" << endl; } if(attack=="Magic") { cout << "Which magic?" << endl; cout << "G-[Glacier Ice]" << endl; char choosemagic; cin >> choosemagic; if(choosemagic='G') { enehp-=fp*2; cout << "You did " << enefp*2 << " damage" << endl; mp-=5; } } if(attack=="Run") { cout << "You ran down stairs!!!" << endl; goto downstairs; } float hurtyou=enefp-dp; hp-=hurtyou; cout << "The enemy did " << hurtyou << " damage!" << endl; if(hp <= 0) { cout << "You died" << endl; cin.ignore(); cin.get(); return 0; } } cout << "You gained 50 exp!" << endl; exp+=50; cout << "You ran downstairs to see your mom." << endl; downstairs: cout << "Mom: Your dad called. He says for you to meet him at the battle arena." << endl; cin.ignore(); cin.get(); return 0; }



LinkBack URL
About LinkBacks


