I've just started C++ a while ago. I do have a background in Basic, but these two are nothing alike. The problem I have is with this Text based game. When it gets to the smiliy face, the window shuts off, and nothing happens. I'm sure it's just a simple problem but I can't find it. Please help if you can.
And if anyone knows how to use the Goto/Label function, please tell me!![]()
Code:#include <iostream> #include <cstring> #include <cstdlib> using namespace std; int main() // This is the beginning, and choose species. { char species[5]; int age; char name[25]; char backpack[100]; cout<<" Greetings, friend, and Welcome, to...\n"; cin.get(); cout<<" The Lord of The Rings RPG (V1.0)\n"; cout<<" You will be playing the part of one of the many species\n"; cout<<" of Middle Earth, on an epic quest to save the world, and\n"; cout<<" destroy the one ring. To begin, please choose your species...\n"; cin.get(); cout<<" \n"; cout<<" A balanced Human.\n"; cout<<" A powerful fierce, yet short Dwarf.\n"; cout<<" A stealthy, dead eye Elf.\n"; cin.getline ( species, 5); cin.ignore(); if ( strcmp (species, "Human") == 0){ cout<<" Human.\n"; } else if (strcmp (species, "Dwarf") == 0){ cout<<" Dwarf.\n"; } else if (strcmp (species, "Elf") == 0){ cout<<" Elf.\n"; } else { cout<<"Restart, and choose a real species!\n"; } cout<<" What is your name(under 25 letters)?\n"; //This is the name. cin.getline ( name, 25); cin.get(); cout<<" And last, what is your age?\n"; //This is the age. cin>> age; cout<<" Wow, a "<<age<<" year old "<<species<< " named "<<name<<". Now I've\n"; cout<<" Seen everything! Anyway...\n"; cout<<" \n"; cout<<" You begin your quest, in your small village. You have little armour,\n"; cout<<" except for the clothes on you back, and your sword is of crappy wood.\n"; cin.get(); }



LinkBack URL
About LinkBacks
I've just started C++ a while ago. I do have a background in Basic, but these two are nothing alike. The problem I have is with this Text based game. When it gets to the smiliy face, the window shuts off, and nothing happens. I'm sure it's just a simple problem but I can't find it. Please help if you can.




How the crap could I screw up so bad? Thanks a ton.