编译错误:登录和菜单

时间:2013-10-02 05:10:26

标签: c++ algorithm login menu

所以我得到一个编译错误,说: 12 C:\ Dev-Cpp \ login.cpp期望在“while”之前的nonqualified-id 12 C:\ Dev-Cpp \ login.cpp期望,' or;'在“while”之前  C:\ Dev-Cpp \ Makefile.win [构建错误] [login.o]错误1

这是我的代码:

#include <iostream>
#include <string>

using namespace std;

int main ()
{
string username;
string password;
int attemptCount = 0;
}
while ( attemptCount < 3 )
{
cout << "Enter your username: " << endl;
cin >> username;
cout << "Enter your password: " << endl;
cin >> password;

if ( username != "Invitado" && password != "abel" )

{
int choice;
bool gameOn = true;
while (gameOn != false){
cout << "\n\n\n\n\n\n\n\n\n\n\n";
cout << " 1 - Inicia el juego.\n\n";
cout << " 2 - Modo Historia.\n\n";
cout << " 3 - Ayuda.\n\n";
cout << " 4 - Salir.\n\n";
    cout << "\n\n\nElige tu opcion\n\n\n ";

cin >> choice;

switch (choice)
{
case 1:
cout << "\n\n\n\nBienvenido al juego...!\n";
// rest of code here
break;
case 2:
cout << "\n\n\n Este es el progreso hasta el momento\n";
// rest of code here
break;
case 3:
cout << "\n\n\n\n\n\n\n\nPara ayuda, por favor visite www.blabla.com!\n";
// rest of code here
break;
case 4:
cout << "\n\n\nFin del programa.\n";
gameOn = false;
break;
default:
cout << "\n\n\nNo es una opcion valida. \n";
cout << "\n\n\nElige de nuevo.\n";
cin >> choice;
break;
}
}
return 0;
}

0 个答案:

没有答案