#include<iostream.h>
#include<conio.h>
#include<string.h>
void stores();
void main ()
{
int choice;
cout<<"Welcome to the Pearl continental User control panel\n\n";
cout<<"Please Choose the options given below\n";
cout<<"1)-Enter Stores department\n";
cout<<"2)-Enter Finance department\n";
cout<<"3)-Enter Human Resource department\n";
cin>>choice;
if(choice==1)
{
stores();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////
void stores()
{
cout<<"Welcome to the Stores department\nPlease enter your password to continue:";
int pInput;
int i;
char pw[5],ch;
do
{
cout << "Enter Password: ";
for ( i = 0; i < 5 && (pInput = getch()) != 13; ++i ) {
pw[i] = pInput;
putch('*');
}while(pInput!=13);
pw[i] = '\0'; // to stop taking input
cout << endl;
if ( strcmp(pw, "admin") == 0 )
{
cout << "Correct" << '\n';
} else
{
cout << "Incorrect" << '\n';
}
}
/*
** Simple formating of your code shows that you are missing a } here.
*/
Edit:
The comment might have been misleading. It was meant to indicate that as the last brace had not returned to the left hand side then it indicates that there is a missing brace. The missing one is the closing of the for loop and should be between lines 35 and 36
#include<iostream.h>
#include<conio.h>
#include<string.h>
void stores();
void main ()
{
int choice;
cout<<"Welcome to the Pearl continental User control panel\n\n";
cout<<"Please Choose the options given below\n";
cout<<"1)-Enter Stores department\n";
cout<<"2)-Enter Finance department\n";
cout<<"3)-Enter Human Resource department\n";
cin>>choice;
if(choice==1)
stores();
}
/////////////////////////////////////////////////////////////////////////////////////////////////
void stores()
{
int pInput;
int i;
char pw[5],ch;
cout<<"Welcome to the Stores department\nPlease enter your password to continue:";
do
{
cout << "Enter Password: ";
for ( i = 0; i < 5 && (pInput = getch()) != 13; ++i )
{
pw[i] = pInput;
putch('*');
}
/*
** There should be a } while (...); around here somwhere
*/
pw[i] = '\0'; // to stop taking input
cout << endl;
if ( strcmp(pw, "admin") == 0 )
cout << "Correct" << '\n';
else
cout << "Incorrect" << '\n';
}