File tree 1 file changed +34
-2
lines changed
1 file changed +34
-2
lines changed Original file line number Diff line number Diff line change 1
1
#include < iostream>
2
+ #include < fstream>
3
+ #include < string>
4
+
5
+ int main (int argc, char *argv[]) {
6
+ if (argc == 1 ) {
7
+ std::cerr << " Usage: " << argv[0 ] << " <path to input>" << std::endl;
8
+ return 1 ;
9
+ }
10
+
11
+ std::vector<std::string> board;
12
+ std::string instructions;
13
+
14
+ {
15
+ std::ifstream file;
16
+ file.open (argv[1 ]);
17
+
18
+ bool in_board = true ;
19
+ for (std::string line; std::getline (file, line);) {
20
+ if (in_board) {
21
+ if (line.empty ()) {
22
+ in_board = false ;
23
+ } else {
24
+ board.push_back (line);
25
+ }
26
+ } else {
27
+ instructions += line;
28
+ }
29
+ }
30
+ }
31
+
32
+ for (const std::string &line : board) {
33
+ std::cout << " Line: " << line << std::endl;
34
+ }
35
+ std::cout << " Instructions: " << instructions << std::endl;
2
36
3
- int main () {
4
- std::cout << " Hello" << std::endl;
5
37
return 0 ;
6
38
}
You can’t perform that action at this time.
0 commit comments