bit behind, so much work

This commit is contained in:
Benjamin Kyd
2020-12-06 00:31:14 +00:00
parent 7e353fc760
commit 77ecdee0f8
66 changed files with 12636 additions and 11133 deletions

View File

@@ -1,56 +1,56 @@
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
std::unordered_map<std::string, std::string> mapise( std::vector<std::string> input )
{
std::unordered_map<std::string, std::string> ret;
for ( auto& str : input )
{
std::string first = str.substr(0, 3);
std::string second = str.substr(4, str.size());
ret[first] = second;
std::cout << first << " " << second << std::endl;
}
return ret;
}
int main(int argc, char** argv)
{
std::ifstream infile( argv[1] );
std::vector<std::string> lines;
std::string line;
while (!infile.eof())
{
std::getline(infile, line);
if ( line.length() == 0 ) continue;
lines.push_back(line);
}
int accumilator = 0;
auto map = mapise( lines );
std::unordered_map<std::string, std::string>::iterator it;
for (it = map.begin(); it != map.end(); it++)
{
}
std::cout << "Sum of direct and indirect orbits : " << accumilator << std::endl;
}
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
std::unordered_map<std::string, std::string> mapise( std::vector<std::string> input )
{
std::unordered_map<std::string, std::string> ret;
for ( auto& str : input )
{
std::string first = str.substr(0, 3);
std::string second = str.substr(4, str.size());
ret[first] = second;
std::cout << first << " " << second << std::endl;
}
return ret;
}
int main(int argc, char** argv)
{
std::ifstream infile( argv[1] );
std::vector<std::string> lines;
std::string line;
while (!infile.eof())
{
std::getline(infile, line);
if ( line.length() == 0 ) continue;
lines.push_back(line);
}
int accumilator = 0;
auto map = mapise( lines );
std::unordered_map<std::string, std::string>::iterator it;
for (it = map.begin(); it != map.end(); it++)
{
}
std::cout << "Sum of direct and indirect orbits : " << accumilator << std::endl;
}