View Single Post
  #1 (permalink)  
Old November 30th, 2007, 01:12 PM
WHSCT WHSCT is offline
Registered User
 
Join Date: Nov 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default using a one line input for array

What I need to do is have input from one line (integers) and then put them into different variables... Let me explain with code:

THEORETICAL CODE:

Code:
#include <cstdlib>
#include <iostream>


using namespace std;

int main(int argc, char *argv[])
{
    int input[6];       //This will be the array for input

    cin >> input[];  //I know this wont work. What I want to do is
                     //the input will be seperated by comas... 
                     //ie: 1,2,3,4,5,6
                     //How can i do this so that the "1"
                     //goes into input[0].. the "2" into input[2]ect??

    system("PAUSE");
    return 0;
}

Get it? after that I take the numbers individually and put them into variables... but that is unimportant.


Thanks for all your help!!
~Nick

Reply With Quote