4 //FIXME: Comment the code !!!
6 void displayMenuEntry(int num
, const char* option
) {
7 printf("%d - %s\n", num
, option
);
11 displayMenuEntry(1, "Addition");
12 displayMenuEntry(2, "Soustraction");
13 displayMenuEntry(3, "Multiplication");
14 displayMenuEntry(4, "Division");
15 displayMenuEntry(5, "Puissance");
16 displayMenuEntry(6, "Quitter");
19 int promptValue(const char* invite
) {
26 int promptOperation() {
28 return promptValue("Veuillez saisir un choix ?");
31 int doAddition(int val1
, int val2
) {
35 int doSubstraction(int val1
, int val2
) {
39 int doMultiplication(int val1
, int val2
) {
43 int doDivision(int val1
, int val2
) {
45 printf("Division par zero !\n");
46 // FIXME: I'm not very fond of this convention ...
53 int doPuissance(int base
, int expo
) {
57 } else if ( expo
% 2 == 0 ) {
58 power
= doPuissance(base
*base
, expo
/2);
60 power
= base
*doPuissance(base
*base
,(expo
-1)/2);
66 int choice
= promptOperation();
67 printf("Choice: %d\n", choice
);