What I'm trying to do is read a line from stdin and break it, using spaces as delimiters.
Say I have this as an input:
2
1 2
3 4
The first line gives me the number of lines I would like to read, these are all lines with integers separated by an unknown number of spaces (i.e. there can be 1 space, but it can also be 10 spaces). <w> What I was trying to do was read these lines into arrays with dynamic integer size.
It was very simple in Python:
foo = raw_input()
array = foo.split()
or even shorter:
foo = raw_input().split()
However, due to circumstances, I have to find out the beauty of C ++. So I tried to create something similar to the above Python code:
#include <iostream>
using namespace std;
int lines;
int *array;
int main() {
cin >> lines;
for (int line = 0; line < lines; line++) {
}
}
, . , std:: cin , . , -, ...
, . .