include <iostream>

include <string>

using namespace std;





  {


    int counter=0;
    string Username;
    string Password;
    string InvalidUser;
    int opt;


    system("cls");
    cout <<"\n\n";
    cout << "                ====== MEDICARE HOSPITAL LOGIN =======";

       cout<<"\n"<<endl;
       cout<<"\n"<<endl;
       cout<<"\n"<<endl;
       cout<<" ***          ******        *******      *************  ****       ***   "<<endl;                                           
       cout<<" ***         ********      *********     *************  *****      ***   "<<endl;                                             
       cout<<" ***        **      **    ***                 ***       *** **     ***   "<<endl;         
       cout<<" ***       **        **  ***    ********      ***       ***  **    ***   "<<endl;                     
       cout<<" ***       **        **  ***    ********      ***       ***   **   ***   "<<endl;    
       cout<<" ***       **        **  ***    ***  ***      ***       ***    **  ***   "<<endl;  
       cout<<" ***        **      **    ***       ***       ***       ***     ** ***   "<<endl;      
       cout<<" **********  ********      ***********   *************  ***      *****   "<<endl;           
       cout<<" **********   ******        *********    *************  ***       ****   "<<endl;                               
       cout<<"\n"<<endl;
       cout<<"\n"<<endl;
       cout<<"\n"<<endl;
       cout<<"\n"<<endl;
       cout<<"\n"<<endl;
       system("color 75");
cout<< "     1 Admin login                            2 Customer login "<<endl;
cout<< "\n"<<endl;
cout<<"Select 1, 2" <<endl;
cout<<"Enter option " <<endl;
cin>>opt;
cout<<"\n"<<endl;

switch (opt)
{
case 1:
    {

    while (counter<=2)
{
    cout<< "Enter Username "<<endl;
    cin>> Username;
    cout<< "Enter Password "<<endl;
    cin>> Password;

    if((Username=="admin")&&(Password=="123"))
{
    system("cls");
    cout<< "Welcome to Admin Account! "<<endl;
    break;
    cout<<"\n"<<endl;   
}
    else
{

    cout<< "Invalid user, Check your login details " <<endl;
}
    counter++;
}
    if(counter<=2)
{
cout<< "Welcome to admin Account! "<<endl;
}
    else
    {
    cout<< "Unauthorized User contact help desk " <<endl;
    }
    }
case 2:

    {
    cout<< "Enter Username "<<endl;
        cin>> Username;

        cout<< "Enter Password "<<endl;
        cin>> Password;

        if((Username=="afra")&&(Password=="123"))

       {
           system("cls");
            cout<< "Welcome to customer Account! "<<endl;
            cout<<"\n"<<endl;
            break;

        }
        else
        {
            cout<< "Invalid user, Check your login details " <<endl;
        }
    }
}
void main() 


{
    system("pause");
}

main() needs to be moved from line 105 to line 6. It should also be int main(). main() should always return an int. You also need to get rid of lines 108-110. You should also add a break after case 1.

The error tells you exactly what is wrong. You don't tell the compiler what the code inside the braces means. You need return type Name(arguments).

This article has been dead for over six months. Start a new discussion instead.