If you use strings instead of char arrays, it will be easier. First include the header:
> void startproc (char user_pass[50], char pass[50] );
> void average (int avnum, int total, int divisor, int answer, char YorN[2]);
Make the above:
Code:
void startproc (string &user_pass, string &pass );
void average (int avnum, int total, int divisor, int answer, string YorN);
> cin.getline ( user_pass, 50);
Make the above:
Code:
getline ( cin, user_pass);
> cin.getline(YorN, 2);
Make the above:
Code:
getline(cin, YorN);
> while ( strcmp (YorN, "n") == 0)
Make the above:
Code:
while ( YorN == "n")
To correct the original code, you would need to actually pass char arrays to your member function. For example:
Code:
> functions.startproc(0, 0);
Would need to take two char arrays:
Code:
char pass[50], user_pass[50];
functions.startproc(pass, user_pass);
Or you can probably just declare them local to the function:
Code:
void Calculator::startproc ()
{
char user_pass[50], pass[50];
ifstream pass_one ( "Pass1.txt" );
pass_one>> pass;
cout<< "Please enter the password to access this program.\n";
cin.getline ( user_pass, 50);
}