30 lines
493 B
C++
30 lines
493 B
C++
|
#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;
|
||
|
}
|