#include #include #include #include "ex3/Addition.cpp" #include "ex3/Soustraction.cpp" #include "ex3/Multiplication.cpp" #include "ex3/Division.cpp" #include "ex3/DivisionEuclidienne.cpp" #include "ex3/Trinome.cpp" #include "ex3/Puissance.cpp" #include "ex3/Racine.cpp" using namespace std; int main(){ int choix(0); char input[8] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'}; char output[8] = {'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'}; /* [1] On initialise les operations =========================================================*/ vector operations; // On ajoute les operations; operations.push_back( new Addition() ); operations.push_back( new Soustraction() ); operations.push_back( new Multiplication() ); operations.push_back( new Division() ); operations.push_back( new DivisionEuclidienne() ); operations.push_back( new Trinome() ); operations.push_back( new Puissance() ); operations.push_back( new Racine() ); /* [2] Choix de l'operation a executer =========================================================*/ do{ cout << " +-------------------------+" << endl; for( int i = 0 ; i < operations.size() ; i++ ) cout << " + " << i << ") " << operations[i]->getLibelle() << endl; cout << " +-------------------------+" << endl; cout << " + Choix: "; cin >> choix; cout << endl << endl; cout << "=======================================" << endl; }while( choix < 0 || choix >= operations.size() ); /* [3] On recupere les operandes pour le calcul =========================================================*/ float scanner; int countOp(0); while( operations[choix]->missingOperand() ){ cout << input[countOp] << " = "; cin >> scanner; cout << endl; operations[choix]->addOperand(scanner); countOp++; } float* result = operations[choix]->calc(); for( int i = 0 ; result[i] != '\0' ; i++ ) cout << output[i] << " = " << result[i] << endl; return 0; }