How To Make An Array Based On User Input

Mar 20, 2012 at 7:16pm
I need my array or a vector that will be the size the user wants it to be. I also need syntax and stuff like that Thank You
Mar 20, 2012 at 8:12pm
There's this awesome website I found(don't know if you are aware of it) but you can just type in a question and with a little bit of reading usually find an explanation/answer.

It's called google.

It's crazy how useful it is!
Mar 20, 2012 at 8:18pm
lol ok :D
Mar 20, 2012 at 9:18pm
i got that but whats the syntax like i need x amount of variables then i need the user to write the variables how?
1
2
3
4
vector<int> x;
cin >> x;
cin >> x[0];
cin >> x[1]

????
Mar 21, 2012 at 5:14am
1
2
3
4
5
6
7
std::vector<int> v ;

std::cout << "Enter some numbers: " ;

int input ;
while ( std::cin >> input )
     v.push_back(input) ;
Mar 23, 2012 at 3:58am
thanks!
Topic archived. No new replies allowed.