Thread: Action Based On User Input

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    75

    Action Based On User Input

    ok sorry guys it's me again


    I just wanted to know how could do something like
    prompt the user for input but they can only type a certain thing like if I had something like


    char password[5] = "open";
    char user_password[5];

    cout << "Please Type Password Here\n";
    cin >> user_password;


    to find out if the user_password is the same as password
    would I do something like


    if (user_password = password)
    blah blah;




    would that be a correct way of checking
    cause I think I tried that and I didnt get the outcome I expected


    plz if u uinderstand what I'm getting at can u plz help me


    cheers


    stealth

  2. #2
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    You'd use strcmp() (string.h) or wstrcmp(), ev. _mbstrcmp() if Unicode or MBCS.
    Have fun!

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    75

    thanks

    thanks for the help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. timed user input
    By sainiabhishek in forum C Programming
    Replies: 4
    Last Post: 04-01-2009, 11:59 AM
  2. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  3. SSH Hacker Activity!! AAHHH!!
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 03-06-2005, 03:53 PM
  4. Nested Structures - User Input
    By shazg2000 in forum C Programming
    Replies: 2
    Last Post: 01-09-2005, 10:53 AM
  5. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 06:01 AM