00001 #include "macros.h" // needs to be declared as first entry in .cpp or .h file! 00002 #include <iostream> 00003 #include <string> 00004 #include "Driver.h" 00005 #include "AbstractExercise.h" 00006 #include "ExerciseStore.h" 00007 using namespace std; 00008 00014 int Driver::instantiate(string name){ 00015 AbstractExercise *ae = ExerciseStore::instance()->getExercise(name); 00016 if(ae == 0){ 00017 cout << "Exercise <" << name << "> not found." << endl; 00018 } else { 00019 cout << endl; 00020 ae->start(); 00021 cout << endl; 00022 waitForKey(); 00023 } 00024 return 0; 00025 } 00026 00027 Driver::~Driver(){ 00028 ExerciseStore::destroyInstance(); 00029 } 00030 00031 void Driver::waitForKey(){ 00032 string str; 00033 cout << "Press ENTER key:" << endl; 00034 cin.ignore(INT_MAX, '\n'); 00035 cin.get(); 00036 }