blob: d2d599f44e5a0d7aea381fdc91a7d7469aee54ca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
#define SIZE 100
int maxRow = 0, maxColumn = 0;
void getInput(int input[SIZE][SIZE]);
int main() {
int column = 0, row = 0;
/*
Array is set up as follows
C
R 0 1 ...
1
...
*/
int inputArray[SIZE][SIZE] = {0};
getInput(inputArray);
}
void getInput(int input[SIZE][SIZE]) {
string test;
//I would mainly like to thank some random person on StackOverflow for solving my problem
while (getline(cin,test)) {
istringstream ss(test);
string foo; //foo is only needed in this one scope and will not be named further.
while(getline(ss,foo,' '))
maxRow=0;
{
input[maxRow][maxColumn] = stoi(foo);
maxRow++;
}
maxColumn++;
}
cout << maxRow << " " << maxColumn << endl;
}
|