Thread: Check if input password is correct

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    2

    Unhappy Check if input password is correct

    I have created a login with username and password. But now the username and password is not checked if it's right. So my question is how do I get the program to check in a database if the username and password is correct?

    _______________
    Venlig hilsen Jess

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    How can you expect someone to help you without posting some code? We have no idea what your program looks like...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User WayTooHigh's Avatar
    Join Date
    Aug 2001
    Posts
    101
    use the strcmp() function.
    Code:
    #include<iostream.h>
    #include<string.h>
    
    int main()
    {
    	char User_Entered_Password[255], Correct_Password[255] = "the password";
    
    	cout<<"Enter the password:\n";
    	cin.getline(User_Entered_Password, 255, '\n');
    
    	if(!strcmp(User_Entered_Password, Correct_Password))
    	{
    		cout<<"Correct Password!";
    	}
    	else
    	{
    		cout<<"Wrong Password!";
    	}
    
    	return 0;
    }
    Sometimes, the farthest point from the center is the center itself.

    Your life is your canvas, it's only as beautiful as you paint it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. allegro issues
    By mramazing in forum C++ Programming
    Replies: 1
    Last Post: 01-07-2009, 11:56 PM
  2. Want input in password format
    By Lokesh in forum C Programming
    Replies: 3
    Last Post: 10-30-2007, 02:18 PM
  3. How to check somebody's password?
    By marinus in forum Linux Programming
    Replies: 8
    Last Post: 09-10-2005, 10:17 AM
  4. help with input check
    By negevy in forum C Programming
    Replies: 1
    Last Post: 09-02-2005, 07:14 AM
  5. how do you check to see if input is an int?
    By pkananen in forum C++ Programming
    Replies: 10
    Last Post: 02-20-2002, 04:57 PM