Thread: Multiple variable cin line

  1. #1
    Spaced Cadet
    Join Date
    Aug 2003

    Multiple variable cin line

    is it possible to do a multiple variable cin line

    user types:
    west 1200

    it activates an if statement for the string if the first variable is set to 'west' and then moves the character that many paces

    this is for a test-based rpg, sorry if this is the wrong board

  2. #2
    Registered User
    Join Date
    Nov 2002
    like this?

    string direction;
    int paces;
    cin >> direction >> paces;
    if(direction == "west") {
      //move paces

  3. #3


    I was just about to post that, I am way too slow But anyway, is this going to be like the game Zork, b/c if it is make sure to send me a copy!!! Zork is one of the best games ever, I would easily choose it over GTA: Vice City.
    Give me a bad reputation!!!

  4. #4
    Spaced Cadet
    Join Date
    Aug 2003
    yes, it worked, thank you.

    edit, Unaminous> send me your email, and I'll put you on the beta-testing list, I already have someone to port it to mac.
    aim: nemesis2darkness
    if you msn/aim me, tell me that you're from this board, other-wise It gets very confusing
    Last edited by Dark Nemesis; 08-02-2003 at 10:59 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Handling multiple input files from command line
    By cnfwriter in forum C Programming
    Replies: 13
    Last Post: 08-25-2008, 08:07 AM
  2. cin - reading empty line;
    By apacz in forum C++ Programming
    Replies: 6
    Last Post: 05-31-2007, 02:02 PM
  3. Quick, newbie question: Multiple line string
    By crummy in forum C# Programming
    Replies: 2
    Last Post: 03-10-2005, 05:58 AM
  4. Use of variable
    By alice in forum C Programming
    Replies: 8
    Last Post: 06-05-2004, 07:32 AM
  5. Getting multiple inputs using cin
    By edk in forum C++ Programming
    Replies: 2
    Last Post: 09-13-2001, 02:34 PM
Website Security Test