I want the user to type in a command then display a string but i keep getting my default error messege.
Code:#include <stdlib.h> #include <iostream> #include <string> #include <conio.h> #include <windows.h> using namespace std; string overview(); string races(); string world(); int main() { char name[50]; int input; cout << " Welcome to my test Proggy!" << endl; cout << " What is your name?" << endl; cin.getline(name, 50, '\n'); cout << " Hello " << name; cout << endl << " Please choose one of the options below "; cout << endl; cout << " 1. Overview " << endl; cout << " 2. Races." << endl; cout << " 3. World." << endl; cin >> input; switch (input) { case 1: overview (); break; case 2: races (); break; case 3: world (); break; default: cout<<"Error, bad input, quitting"; } system("pause"); return 0; } string overview() { return " An Overview of DragonWars:"; } string races() { return " An Overview of Races:"; } string world() { return " An Overview of the world:"; }



LinkBack URL
About LinkBacks


