blob: 01b78b2ed396674d95dbabc105c20ca596e74ee3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#include <iostream>
#include <exception>
#include <fstream>
#include "Parser.h"
#include "Circuit.h"
using std::cout;
using std::endl;
using std::fstream;
using std::exception;
int main(int argc, char** argv) {
Parser main_parser;
Circuit circuit;
main_parser.setCircuit(circuit);
fstream file{"circuits/full-adder.txt", file.out};
try {
main_parser << file;
} catch (exception e) {
cout << "Parser error: " << e.what() << endl;
return EXIT_FAILURE;
}
try {
circuit.run();
} catch (exception e) {
cout << "Circuit error: " << e.what() << endl;
return EXIT_FAILURE;
}
cout << "Circuit output: " << circuit.getOutput() << endl;
return EXIT_SUCCESS;
}
|