We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0168094 commit 6f4cec4Copy full SHA for 6f4cec4
2021/day01/part1/solution.cpp
@@ -0,0 +1,28 @@
1
+#include <iostream>
2
+#include <fstream>
3
+
4
+using namespace std;
5
6
+int main() {
7
+ ifstream infile ("../input");
8
+ int inputNumbers[2000];
9
10
+ int curInNumber;
11
+ int curInLineInx = -1;
12
+ while (infile >> curInNumber) {
13
+ curInLineInx += 1;
14
+ inputNumbers[curInLineInx] = curInNumber;
15
+ }
16
17
+ int wentDeeperTimes = 0;
18
+ int prevNum = inputNumbers[0];
19
+ for (int i = 1; i < 2000; i++) {
20
+ int curNum = inputNumbers[i];
21
+ if (curNum > prevNum) {
22
+ wentDeeperTimes += 1;
23
24
+ prevNum = curNum;
25
26
27
+ cout << wentDeeperTimes << endl;
28
+}
0 commit comments