diff --git a/FirstClassEdem.cpp b/FirstClassEdem.cpp new file mode 100644 index 0000000..4aef5fb --- /dev/null +++ b/FirstClassEdem.cpp @@ -0,0 +1,12 @@ +#Include +#include + +Class FirstCLassEdem { + int FirstNumber, SecondNumber; + public double RandomFunction (int Parameter1, int Parameter2); +} FirstUse + + +double FirstClass::RandomFunction (int AddValue, int MultipValue){ + return ( (3.14159)*(MultipValue + AddValue)/(9.51413) ); +} diff --git a/main.cpp b/main.cpp index 266995c..d04d0a1 100644 --- a/main.cpp +++ b/main.cpp @@ -5,9 +5,11 @@ Date: 2013 */ -#include +// MDA Tutorial version = AddedLine + +#include #include -#include +#include #include #include "NeuralNetwork.h" #include "utils.h" @@ -16,71 +18,71 @@ int main(int argc, char *argv[]) { char buff[50]; - time_t rawtime; - struct tm * timeinfo; - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); + time_t rawtime; + struct tm * timeinfo; + time ( &rawtime ); + timeinfo = localtime ( &rawtime ); strftime (buff, 80, "logs/DNN-%Y-%m-%d-%H-%M-%S.log", timeinfo); - if (LOGGING) + if (LOGGING) file = fopen (buff, "w"); numNeurons = 0; NeuralNetwork* net = NULL; - printf("> ---------------------\n" - "> 1) Train OR gate behaviour\n" - "> 2) Train AND gate behaviour\n" - "> 3) Train XOR gate behaviour\n" - "> 4) Train MNIST\n" - "> 5) Empty\n" - "> 6) Exit\n" - "> 7) Load settings and create neural network\n" + printf("> ---------------------\n" + "> 1) Train OR gate behaviour\n" + "> 2) Train AND gate behaviour\n" + "> 3) Train XOR gate behaviour\n" + "> 4) Train MNIST\n" + "> 5) Empty\n" + "> 6) Exit\n" + "> 7) Load settings and create neural network\n" "> 8) Load new settings from config file\n" - "> 9) Reset/Remake neural network\n" - "> Press '0' to display menu\n" - "> ---------------------\n" + "> 9) Reset/Remake neural network\n" + "> Press '0' to display menu\n" + "> ---------------------\n" ">Please enter your selection: "); int input = 0; - scanf("%d", &input); - while (input != 6) { - switch (input) { + scanf("%d", &input); + while (input != 6) { + switch (input) { case 1: if (net == NULL) { printf ("You do not have an active Neural Network running.\n"); } - else { + else { net->trainOR(); - } - break; - case 2: + } + break; + case 2: if (net == NULL) { printf ("You do not have an active Neural Network running.\n"); } - else { + else { net->trainAND(); - } + } break; case 3: if (net == NULL) { printf ("You do not have an active Neural Network running.\n"); } - else { + else { net->trainXOR(); } - break; + break; case 4: if (net == NULL) { printf ("You do not have an active Neural Network running.\n"); } - else { + else { net->trainMNIST(200, 50); - } - break; - case 5: - - break; + } + break; + case 5: + + break; case 7: read_config("settings.config"); printf ("Settings successfully loaded.\n"); @@ -92,11 +94,11 @@ int main(int argc, char *argv[]) { } printf ("Starting new Neural Network:\n"); net = new NeuralNetwork("reservoir_settings.config"); - printf ("New Neural Network successfully created.\n"); - break; - case 8: + printf ("New Neural Network successfully created.\n"); + break; + case 8: read_config("settings.config"); - printf ("Settings successfully loaded.\n"); + printf ("Settings successfully loaded.\n"); break; case 9: if (net != NULL) { @@ -108,28 +110,28 @@ int main(int argc, char *argv[]) { printf ("Starting new Neural Network:\n"); net = new NeuralNetwork(); printf ("New Neural Network successfully created.\n"); - break; - case 0: - printf("> ---------------------\n" - "> 1) Train OR gate behaviour\n" - "> 2) Train AND gate behaviour\n" - "> 3) Train XOR gate behaviour\n" - "> 4) Train MNIST\n" - "> 5) Empty\n" - "> 6) Exit\n" - "> 7) Load settings and create neural network\n" + break; + case 0: + printf("> ---------------------\n" + "> 1) Train OR gate behaviour\n" + "> 2) Train AND gate behaviour\n" + "> 3) Train XOR gate behaviour\n" + "> 4) Train MNIST\n" + "> 5) Empty\n" + "> 6) Exit\n" + "> 7) Load settings and create neural network\n" "> 8) Load new settings from config file\n" - "> 9) Reset/Remake neural network\n" - "> Press '0' to display menu\n" - "> ---------------------\n" - ">Please enter your selection: "); - break; - default: - printf("> Invalid input. Please try again.\n"); - break; - } - printf("\n>Please enter your selection: "); - scanf("%d", &input); + "> 9) Reset/Remake neural network\n" + "> Press '0' to display menu\n" + "> ---------------------\n" + ">Please enter your selection: "); + break; + default: + printf("> Invalid input. Please try again.\n"); + break; + } + printf("\n>Please enter your selection: "); + scanf("%d", &input); } printf ("Exiting...\n"); if (net != NULL) {