Added day 6 (two programs. had to rewrite for the second problem). Added starter files.
This commit is contained in:
2
2022/starter/Makefile
Normal file
2
2022/starter/Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
a.out: main.cpp
|
||||
clang++ -std=c++2b -g -O0 main.cpp
|
29
2022/starter/main.cpp
Normal file
29
2022/starter/main.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ifstream ifs("data.txt");
|
||||
if(!ifs.is_open())
|
||||
{
|
||||
std::cerr << "Missing data.txt." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned long total = 0;
|
||||
unsigned long total_pt2 = 0;
|
||||
|
||||
for(std::string line; std::getline(ifs, line); )
|
||||
{
|
||||
if(line == "")
|
||||
continue;
|
||||
}
|
||||
|
||||
std::cout << " Total: " << total << std::endl;
|
||||
std::cout << "PT2 Total: " << total_pt2 << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user