24 lines
521 B
C++
24 lines
521 B
C++
#include <iostream>
|
|
#include <utility>
|
|
|
|
#include <intcode/intcode.hpp>
|
|
using namespace intcode;
|
|
|
|
namespace {
|
|
|
|
auto Compute(Machine machine, ValueType d) -> ValueType {
|
|
ValueType output = -1;
|
|
Run(machine,
|
|
[=](){ return d; },
|
|
[&](auto o) { output = o; });
|
|
return output;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
auto main(int argc, char** argv) -> int {
|
|
auto machine = Startup(argc, argv);
|
|
std::cout << "Part 1: " << Compute(machine, 1) << std::endl;
|
|
std::cout << "Part 2: " << Compute(std::move(machine), 2) << std::endl;
|
|
}
|