I was working on Lesson 5: Switching Cases of cprogramming.com's C++ tutorials however the code given was incomplete, but the author said with little work I could define the functions that were left undefined in the source and get a running program...So I gave it a try, and bam - it didn't work! I looked over the code I studied from Chapter 4 on Functions and really can't see where I am messing up, so if someone could give me a hand, I'd appreciate it. Here is my code:
C:/Documents and Settings/David Mackey/My Documents/cprograms/switchcases.cpp: InCode:#include <iostream> using namespace std; #include <conio.h> int playgame(); int loadgame(); int playmultiplayer() int main() { int input; cout<<"1. Play game"; cout<<"2. Load game"; cout<<"3. Play multiplayer"; cout<<"4. Exit"; cin>>input; switch (input) { case 1: playgame(); break; case 2: loadgame(); break; case 3: playmultiplayer(); break; case 4: return 0; default: cout<<"Error, bad input, quitting"; } int playgame() { cout<<"You are playing the game!" } int loadgame() { cout<<"The game is loading!" } int playmultiplayer() { cout<<"You are playing multiplayer!" } return 0; }
function `int main()':
C:/Documents and Settings/David Mackey/My Documents/cprograms/switchcases.cpp:29: parse
error before `{' token
C:/Documents and Settings/David Mackey/My Documents/cprograms/switchcases.cpp: In
function `int loadgame()':
C:/Documents and Settings/David Mackey/My Documents/cprograms/switchcases.cpp:35: parse
error before `}' token
C:/Documents and Settings/David Mackey/My Documents/cprograms/switchcases.cpp: In
function `int playmultiplayer()':
C:/Documents and Settings/David Mackey/My Documents/cprograms/switchcases.cpp:39: parse
error before `}' token
Execution terminated
Thanks for your help in advance.
Respectfully,
David.