-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
42 lines (39 loc) · 818 Bytes
/
main.cpp
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
40
41
42
#include <string>
#include "SLP_Examples.h"
static void show_usage(std::string name)
{
std::cerr << "Usage: " << name << " <option>\n"
<< "Options:\n"
<< "\thelp\t\tShow this help message\n"
<< "\tORPerceptron\tSee how ORPerceptron works\n"
<< "\tANDPerceptron\tSee how ANDPerceptron works\n"
<< std::endl;
}
int main(int argc, char *argv[])
try
{
// Check the number of input parameters
if (argc < 2 || std::string(argv[1]) == "help")
{
// Tell the user how to run the program
show_usage(argv[0]);
return 1;
}
else if (std::string(argv[1]) == "ORPerceptron")
{
ORPerceptron();
}
else if (std::string(argv[1]) == "ANDPerceptron")
{
ANDPerceptron();
}
return 0;
}
catch(const std::invalid_argument& ia)
{
std::cerr << ia.what();
}
catch (...)
{
std::cerr << "Unknown exception!";
}