read each element of a line
This commit is contained in:
parent
5a1721acf7
commit
0d4f948ff5
4 changed files with 1036 additions and 1 deletions
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
|
|
@ -3,8 +3,10 @@
|
||||||
{
|
{
|
||||||
"type": "cppbuild",
|
"type": "cppbuild",
|
||||||
"label": "C/C++: gcc build active file",
|
"label": "C/C++: gcc build active file",
|
||||||
"command": "/usr/bin/gcc",
|
"command": "/usr/bin/g++",
|
||||||
"args": [
|
"args": [
|
||||||
|
"--std",
|
||||||
|
"gnu++23",
|
||||||
"-fdiagnostics-color=always",
|
"-fdiagnostics-color=always",
|
||||||
"-g",
|
"-g",
|
||||||
"${file}",
|
"${file}",
|
||||||
|
|
|
||||||
1000
2/input.txt
Normal file
1000
2/input.txt
Normal file
File diff suppressed because it is too large
Load diff
BIN
2/puzzle2
Executable file
BIN
2/puzzle2
Executable file
Binary file not shown.
33
2/puzzle2.cpp
Normal file
33
2/puzzle2.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <list>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
list<int> currntlevels{};
|
||||||
|
string line;
|
||||||
|
int safeReports = 0;
|
||||||
|
|
||||||
|
ifstream puzzle("input.txt", ifstream::in);
|
||||||
|
|
||||||
|
while (getline(puzzle, line)) {
|
||||||
|
istringstream lineStream(line);
|
||||||
|
string number;
|
||||||
|
cout << "{";
|
||||||
|
while (getline(lineStream, number, ' ')) {
|
||||||
|
cout << number<<"|";
|
||||||
|
}
|
||||||
|
cout << "}";
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
for (line; !puzzle.eof();puzzle.getline(line,'\n')) {
|
||||||
|
cout << line << "\n";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue