aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ee1301/wk5/hw5_directory/strap012_HW5C.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/ee1301/wk5/hw5_directory/strap012_HW5C.cpp b/ee1301/wk5/hw5_directory/strap012_HW5C.cpp
index 1b1d10d..bc42aa7 100644
--- a/ee1301/wk5/hw5_directory/strap012_HW5C.cpp
+++ b/ee1301/wk5/hw5_directory/strap012_HW5C.cpp
@@ -35,15 +35,15 @@ int main() {
void getInput(int input[SIZE][SIZE]) {
string test, temp1; int temp2=0;
//I would mainly like to thank whatever user on StackOverflow solved my problem
- while (getline(cin,test)) {
- temp2 = -2;
+ while (getline(cin,test,'\n')) {
+ temp2 = -1;
istringstream ss(test);
while(getline(ss,temp1,' ')) {
temp2++;
input[maxRow][temp2] = stoi(temp1);
}
if (temp2>maxColumn) {
- maxColumn = temp2+2; //2 is added to make the math work.
+ maxColumn = temp2+1; //1 is added to make the math work.
}
maxRow++;
}