Here is the exact line of code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
#include <iostream>
#include <string>
using namespace std;
void menu (int& a)
{
cout << " 1 - Start Game.\n";
cout << " 2 - Online Multiplayer.\n";
cout << " 3 - Clans.\n";
cout << " 4 - Achievements.\n";
cout << " 5 - Downloadable Content.\n";
cout << " 6 - Settings.\n";
cout << " 7 - Exit.\n";
cout << " Enter your choice and press return: ";
cin >> a;
}
void decision(int& a)
{
int choice;
switch (a)
{
case 1: cout << "Heres the game!.\n";
cout << "To Go Back Press 0.\n";
cin >> a;
break;
case 2: cout << "Working on Multiplayer!\n";
cout << "To Go Back Press 0.\n";
// rest of code here
break;
case 3: std::string clanname;
std::getline( std::cin, clanname ); // <- gets one line of text from the user, puts it in "clanname" variable
std::cout << "your clan name is " << clanname;
break;
case 4: cout << "Noob: Play this game online/offline for an hour!\n";
cout << "Grenade Professional: Get two kills with one grenade!\n";
cout << "Pro Shooter: Get 100 head shots!\n";
cout << "Lets Play Online: Play one match online!\n";
cout << "Offline Professional: Beat offlie!\n";
cout << "Online Modes: Play one round on every mode online!\n";
cout << "Sniper Maddness: Play on sniper maddness 10 times!\n";
cout << "Battle: Play on battle 10 times!\n";
cout << "Team Battle: Play on team battle 10 times!\n";
cout << "Versus: Play on versus 10 times!\n";
cout << "To Go Back Press 0.\n";
// rest of code here
break;
case 5: cout << "Every thing is 99 cents"\n";
cout << "Skin\n";
cout << "Gamer Point\n";
break;
case 6: cout << "Profile\n";
cout << "Gamer Points\n";
cout << "Skins\n";
cout << "Options\n";
break;
case 7; cout << "Exit\n";
break;
break;
default: cout << "Not a Valid Choice. \n";
cout << "Choose again.\n";
break;
}
int main()
{
int choice;
bool gameOn = true;
menu(choice);
switch (choice)
{
case 1: cout << "Heres the game!.\n";
cout << "To Go Back Press 0.\n";
break;
case 2: cout << "Working on Multiplayer!\n";
"To Go Back Press 0.\n";
// rest of code here
break;
case 3: std::string clanname;
std::getline( std::cin, clanname ); // <- gets one line of text from the user, puts it in "clanname" variable
std::cout << "your clan name is " << clanname;
break;
break;
case 4: cout << "Noob: Play this game online/offline for an hour!\n";
cout << "Grenade Professional: Get two kills with one grenade!.\n";
cout << "Pro Shooter: Get 100 head shots!\n";
cout << "Lets Play Online: Play one match online!\n";
cout << "Offline Professional: Beat offlie!\n";
cout << "Online Modes: Play one round on every mode online!\n";
cout << "Sniper Maddness: Play on sniper maddness 10 times!\n";
cout << "Battle: Play on battle 10 times!\n";
cout << "Team Battle: Play on team battle 10 times!\n";
cout << "Versus: Play on versus 10 times!\n";
cout << "To Go Back Press 0.\n";
// rest of code here
break;
case 5: cout << "Every thing is 99 cents"\n";
cout << "Skin\n";
cout << "Gamer Points
cout << "To Go Back Press 0.\n";
break;
case 6: cout << "Profile\n";
cout << "Gamer Points\n";
cout << "Skins\n";
cout << "Options\n";
cout << "To Go Back Press 0.\n";
break;
case 7: "Exit\n";
break;
gameOn = false;
break;
default: cout << "Not a Valid Choice. \n";
cout << "Choose again.\n";
cin >> choice;
break;
}
system ("pause");
return 0;
}
|
and here are the errors:
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(42): error C2360: initialization of 'clanname' is skipped by 'case' label
1> c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(36) : see declaration of 'clanname'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(56): error C2360: initialization of 'clanname' is skipped by 'case' label
1> c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(36) : see declaration of 'clanname'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(56): error C2017: illegal escape sequence
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(56): error C2001: newline in constant
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(56): error C2146: syntax error : missing ';' before identifier 'n'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(56): error C2065: 'n' : undeclared identifier
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(56): error C2143: syntax error : missing ';' before 'string'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(57): error C2146: syntax error : missing ';' before identifier 'cout'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(62): error C2360: initialization of 'clanname' is skipped by 'case' label
1> c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(36) : see declaration of 'clanname'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(68): error C2143: syntax error : missing ':' before ';'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(68): error C2360: initialization of 'clanname' is skipped by 'case' label
1> c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(36) : see declaration of 'clanname'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(72): error C2361: initialization of 'clanname' is skipped by 'default' label
1> c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(36) : see declaration of 'clanname'
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(79): error C2601: 'main' : local function definitions are illegal
1> c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(20): this line contains a '{' which has not yet been matched
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(119): error C2017: illegal escape sequence
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(119): error C2001: newline in constant
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(121): error C2001: newline in constant
1>c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(146): fatal error C1075: end of file found before the left brace '{' at 'c:\users\tracy\documents\visual studio 2010\projects\hello world\hello world\main.cpp(20)' was matched