Ok i have no idea whats going on here, it wont let me have case 2: or case 3: in my 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
|
void Vars::Game()
{
int choice;
cout << "Main Menu\n" << endl;
cout << "What do you want to do?\n" << endl;
cout << "1) View list of prisoners" << endl;
cout << "2) View list of executed prisoners" << endl;
cout << "3) View prison statistics" << endl;
cout << "4) Execute Prisoner(s)" << endl;
cin >> choice;
switch(choice)
{
case 1:
cout << "Inmate list, maximum 25 inmates\n" << endl;
vector<string> nameVect;
vector<string> crimeVect;
for(int i = 0; i < 25; i++)
{
nameVect.push_back(randNames());
crimeVect.push_back(randCrimes());
}
cout << "Name " << "Crime\n" << endl;
for(int i = 0; i < 25; i++)
{
cout << nameVect[i] << " ";
cout << crimeVect[i] << endl;
}
break;
case 2:
cout << "Executed Prisoners\n" << endl;
break;
case 3:
cout << "Prison Statistics\n" << endl;
cout << "Current Money: " << money << endl;
cout << "Prisoners: " << prisoners << endl;
break;
}
}
| |
C:\Users\Chay Hawk\Desktop\Test project\main.cpp||In member function 'void Vars::Game()':|
C:\Users\Chay Hawk\Desktop\Test project\main.cpp|117|error: jump to case label|
C:\Users\Chay Hawk\Desktop\Test project\main.cpp|101|error: crosses initialization of 'std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > crimeVect'|
C:\Users\Chay Hawk\Desktop\Test project\main.cpp|100|error: crosses initialization of 'std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > nameVect'|
C:\Users\Chay Hawk\Desktop\Test project\main.cpp|120|error: jump to case label|
C:\Users\Chay Hawk\Desktop\Test project\main.cpp|101|error: crosses initialization of 'std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > crimeVect'|
C:\Users\Chay Hawk\Desktop\Test project\main.cpp|100|error: crosses initialization of 'std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > nameVect'|
||=== Build finished: 6 errors, 0 warnings ===|