From: Jérôme Benoit Date: Tue, 18 Feb 2020 03:41:26 +0000 (+0100) Subject: Whitespaces cleqnup. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=fbfa3f7836b7c98def1c28a51b0d13a333175bd4;p=TD_C.git Whitespaces cleqnup. Signed-off-by: Jérôme Benoit --- diff --git a/TP_12/exo1/exo1.c b/TP_12/exo1/exo1.c index 900c5b2..86bace0 100644 --- a/TP_12/exo1/exo1.c +++ b/TP_12/exo1/exo1.c @@ -35,7 +35,7 @@ bool sortFirst(int* array, int length, compare_cb compare) { } void sortArray(int* array, int length, compare_cb compare) { - bool rt; + bool rt; do { rt = sortFirst(array, length, compare); } while (rt); diff --git a/TP_4/tp4.c b/TP_4/tp4.c index 37166eb..f89f89a 100644 --- a/TP_4/tp4.c +++ b/TP_4/tp4.c @@ -31,7 +31,7 @@ int doAddition(int val1, int val2) { } int doSubstraction(int val1, int val2) { - return val1 - val2; + return val1 - val2; } int doMultiplication(int val1, int val2) { @@ -51,7 +51,7 @@ int doDivision(int val1, int val2) { int doPuissance(int base, int expo) { int power = 1; for (int iter = 0; iter < expo; iter++) { - power *= base ; + power *= base; } return power; } @@ -59,9 +59,9 @@ int doPuissance(int base, int expo) { int doPuissanceSmart(int base, int expo) { int power; if (expo == 1) { - power = base; + power = base; } else if (expo % 2 == 0) { - power = doPuissanceSmart(base*base, expo/2); + power = doPuissanceSmart(base*base, expo/2); } else { power = base*doPuissanceSmart(base*base,(expo-1)/2); } @@ -74,8 +74,8 @@ int doPuissanceSmartIter(int base, int expo) { if (expo % 2 == 0) { expo /= 2; } else { - power *= base; - expo = (expo - 1) / 2; + power *= base; + expo = (expo - 1) / 2; } base *= base; } @@ -86,16 +86,16 @@ int doOperation(int selection, int val1, int val2) { int op_result; switch (selection) { case 1: - op_result = doAddition(val1, val2); + op_result = doAddition(val1, val2); break; case 2: - op_result = doSubstraction(val1, val2); + op_result = doSubstraction(val1, val2); break; case 3: - op_result = doMultiplication(val1, val2); + op_result = doMultiplication(val1, val2); break; case 4: - op_result = doDivision(val1, val2); + op_result = doDivision(val1, val2); break; case 5: op_result = doPuissanceSmartIter(val1, val2); @@ -114,7 +114,7 @@ int doOperation(int selection, int val1, int val2) { } */ void promptValue(const char* invite, int* value) { - puts(invite); + puts(invite); scanf("%d", value); } @@ -127,7 +127,7 @@ int main() { int choiceresult, value1, value2, result; for (;;) { choiceresult = promptUserChoice(); - if (choiceresult == 6) break; + if (choiceresult == 6) break; promptBothValues(&value1, &value2); result = doOperation(choiceresult, value1, value2); printf("Le resultat est %d\n", result); diff --git a/TP_7/exo2/exo2.c b/TP_7/exo2/exo2.c index 7a97f69..73cb7e6 100644 --- a/TP_7/exo2/exo2.c +++ b/TP_7/exo2/exo2.c @@ -18,7 +18,7 @@ void displayMenu() { int promptValue(const char* invite) { int value = 0; - puts(invite); + puts(invite); scanf("%d", &value); return value; } @@ -33,7 +33,7 @@ int doAddition(int val1, int val2) { } int doSubstraction(int val1, int val2) { - return val1 - val2; + return val1 - val2; } int doMultiplication(int val1, int val2) { @@ -54,9 +54,9 @@ int doDivision(int val1, int val2) { int doPuissance(int base, int expo) { int power; if ( expo == 1) { - power = base; + power = base; } else if ( expo % 2 == 0 ) { - power = doPuissance(base*base, expo/2); + power = doPuissance(base*base, expo/2); } else { power = base*doPuissance(base*base,(expo-1)/2); } @@ -85,16 +85,16 @@ int doOperation(int selection, int val1, int val2) { break; default: puts("Faire un choix compris entre 1 et 6"); - } + } return op_result; } int main() { int choice = promptOperation(); int value1 = promptValue("Veuillez saisir une valeur entiere initiale ?"); - int value2 = 0, result = 0; + int value2 = 0, result = 0; bool first_loop = true; - + for (;;) { if (choice == 6) break; if (first_loop) { @@ -105,7 +105,7 @@ int main() { } else { value2 = promptValue("Veuillez saisir la prochaine valeur entiere avec laquelle l'operation sera effectuee sur l'ancien resultat ?"); if (value2 == 0) break; - result = doOperation(choice, result, value2); + result = doOperation(choice, result, value2); } printf("Le resultat de l'operation choisie est %d\n\n", result); }