Action Based On User Input

This is a discussion on Action Based On User Input within the C++ Programming forums, part of the General Programming Boards category; ok sorry guys it's me again I just wanted to know how could do something like prompt the user for ...

  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, 02:53 PM
  4. Nested Structures - User Input
    By shazg2000 in forum C Programming
    Replies: 2
    Last Post: 01-09-2005, 09:53 AM
  5. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 05:01 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21