Thread: help with functions in Admin Interface

  1. #1
    Registered User
    Join Date
    Oct 2005

    help with functions in Admin Interface

    I have only been programming for about 7 weeks now and our current assignment is enormous. We have to make an Admin Interface that asks for a login and then verifies it. Then we have to show a full line up of options and do those as well. If anyone could help me with the admin login part it would be greatly appreciated. Here is the part I am not sure how to do.

    There are supposed to be two seperate functions.

    • ValidateAdmin
    o This function receives the id and password, and validate if the id-password pair is valid
    o If the id-password is valid, a true value is returned. Otherwise, a false value is returned instead
    • AdminLogin 巳
    o Prompt and accept a admin’s ID and password, and return this information to the calling function
    o The ID and password returned to the calling function must be valid
    o In case of the invalid ID-password pair entered, an error message must be displayed and a new input is prompted until a valid ID/password pair is provided

    This is my code for them.....Any input would be great.

    bool ValidateAdmin() {
    	ifstream AdminIn;
    	string Id, Password, admin;
 , ios::in);
    	getline(AdminIn, Id);
    	while(!AdminIn.eof()) {
    	getline(AdminIn, Password);
    		//clear screen and return to main menu.
    		getline(AdminIn, Id);
    	if(Id !=Password){
    		cout<<"Invalid user Id and password combination!";
    	if(Id = EnterId && password = EnterPassword){
    		ValidateAdmin = true
    	else ValidateAdmin = false;
    	return ValidateAdmin;
    string AdminLogin {
    	string EnterId, EnterPassword;
    	cout<<"*****   ADMIN LOGIN   *****";
    	cout<<"Enter user ID:";
    	cout<<"Enter a password:";
    	return EnterId;
    	return EnterPassword;
    What way should I be doing this to match the way he is explaining it?

  2. #2
    Registered User cbastard's Avatar
    Join Date
    Jul 2005
    return EnterId;
    return EnterPassword;
    I dont think that you can return two values to the calling should declare a variable that concatenates the user name and password and send it to the calling function.
    if(Id = EnterId && password = EnterPassword){
    Lvalue required.
    Long time no C. I need to learn the language again.
    Help a man when he is in trouble and he will remember you when he is in trouble again.
    You learn in life when you lose.
    Complex problems have simple, easy to understand wrong answers.
    "A ship in the harbour is safe, but that's not what ships are built

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Static member functions more efficient?
    By drrngrvy in forum C++ Programming
    Replies: 6
    Last Post: 06-16-2006, 07:07 AM
  2. Limiting inherited interface
    By tuxster in forum C++ Programming
    Replies: 5
    Last Post: 02-23-2006, 10:21 PM
  3. COM DLL Functions in C
    By CoolDudeMan in forum Windows Programming
    Replies: 4
    Last Post: 06-02-2005, 09:53 AM
  4. API "Clean Up" Functions & delete Pointers :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-10-2002, 06:53 PM
  5. Variables do not equal functions!!!
    By me@burk. in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 06:24 AM