i need to know why it skips automatically to the display denied function w/o looking at the user input if you need more code let me know im scratching my head at this point.
Because you cannot compare a char array with the == operator that way so none of the ifs are ever true. You should be using a string object instead. But if you must use a cstring you can use this: http://www.cplusplus.com/reference/clibrary/cstring/strcmp/
Nope, forget the char variables for now and declare your strings like this:
1 2 3 4 5 6 7 8 9 10 11 12 13
string bob = "bob";
string sue = "sue";
string jane = "jane";
string pam = "pam";
switch(userName)
{
case bob: role = ROLE_ADMIN; break;
case sue: role = ROLE_MANAGER; break;
//code code code etc...
}
You can't use non-integral types with switch.
In the original program, char userName[100]; must be changed to string userName; and void main() to int main(). You also need to include <string>.