From 9ecfed8a384805e9b8aadcd75c811ed2d7624930 Mon Sep 17 00:00:00 2001 From: L0ol4X Date: Wed, 2 Nov 2022 17:24:14 +0100 Subject: [PATCH] to test --- testsaelo.c | 699 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 688 insertions(+), 11 deletions(-) diff --git a/testsaelo.c b/testsaelo.c index aad62e5..9c5c110 100644 --- a/testsaelo.c +++ b/testsaelo.c @@ -128,21 +128,173 @@ void main(void) printf("Nombre d'activités incorrect, veuillez re-saisir (max 3)\n"); scanf("%d%*c", &nbacti); } + + + //si il n'y a qu'un activité if (nbacti == 1) { printf("Quelle est-elle ?(zumba/badminton/musculation/football/squash)\n"); scanf("%s", acti1); - z = strcmp(acti1, "zumba"); - b = strcmp(acti1, "badminton"); - m = strcmp(acti1, "musculation"); - s = strcmp(acti1, "squash"); - f = strcmp(acti1, "football"); - while(z != 0 && b != 0 && m != 0 && s != 0 && f != 0) + z1 = strcmp(acti1, "zumba"); + b1 = strcmp(acti1, "badminton"); + m1 = strcmp(acti1, "musculation"); + s1 = strcmp(acti1, "squash"); + f1 = strcmp(acti1, "football"); + while(z1 != 0 && b1 != 0 && m1 != 0 && s1 != 0 && f1 != 0) + { + printf("Veuillez saisir une activité correcte \n"); + scanf("%s", acti1); + } + if (z1 == 0) + { + numacti = 5; + if (ptsbought < 5) + { + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (b1 == 0) + { + numacti = 1; + if (ptsbought < 8) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 8; + ptsbonus += 8; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (s1 == 0) + { + numacti = 4; + if (ptsbought < 10) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 10; + ptsbonus += 10; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (f1 == 0) + { + numacti = 3; + if (ptsbought < 5) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (m1 == 0) + { + numacti = 2; + if (ptsbought < 15) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 15; + ptsbonus += 15; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + } + + + //si il y a 2 activités + if (nbacti == 2) + { + printf("Quelles sont-elles ?(zumba/badminton/musculation/football/squash)\n"); + scanf("%s", acti1); + scnaf("%s", acti2); + z1 = strcmp(acti1, "zumba"); + b1 = strcmp(acti1, "badminton"); + m1 = strcmp(acti1, "musculation"); + s1 = strcmp(acti1, "squash"); + f1 = strcmp(acti1, "football"); + while(z1 != 0 && b1 != 0 && m1 != 0 && s1 != 0 && f1 != 0) { printf("Veuillez saisir une activité correcte \n"); scanf("%s", acti1); } - if (z == 0) + z2 = strcmp(acti2, "zumba"); + b2 = strcmp(acti2, "badminton"); + m2 = strcmp(acti2, "musculation"); + s2 = strcmp(acti2, "squash"); + f2 = strcmp(acti2, "football"); + while(z2 != 0 && b2 != 0 && m2 != 0 && s2 != 0 && f2 != 0) + { + printf("Veuillez saisir une activité correcte \n"); + scanf("%s", acti2); + } + + + //première activité + if (z1 == 0) { numacti = 5; if (ptsbought < 5) @@ -167,7 +319,7 @@ void main(void) ptsbonus -= 100; } } - if (b == 0) + if (b1 == 0) { numacti = 1; if (ptsbought < 8) @@ -190,7 +342,7 @@ void main(void) ptsbonus -= 100; } } - if (s == 0) + if (s1 == 0) { numacti = 4; if (ptsbought < 10) @@ -213,7 +365,7 @@ void main(void) ptsbonus -= 100; } } - if (f == 0) + if (f1 == 0) { numacti = 3; if (ptsbought < 5) @@ -236,7 +388,7 @@ void main(void) ptsbonus -= 100; } } - if (m == 0) + if (m1 == 0) { numacti = 2; if (ptsbought < 15) @@ -259,10 +411,535 @@ void main(void) ptsbonus -= 100; } } + + + + + //deuxième activité + if (z2 == 0) + { + numacti += 5*10; + if (ptsbought < 5) + { + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (b2 == 0) + { + numacti += 1*10; + if (ptsbought < 8) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 8; + ptsbonus += 8; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (s2 == 0) + { + numacti += 4*10; + if (ptsbought < 10) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 10; + ptsbonus += 10; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (f2 == 0) + { + numacti += 3*10; + if (ptsbought < 5) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (m2 == 0) + { + numacti += 2*10; + if (ptsbought < 15) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 15; + ptsbonus += 15; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } } + + if (nbacti == 3) + { + printf("Quelles sont-elles ?(zumba/badminton/musculation/football/squash)\n"); + scanf("%s", acti1); + scanf("%s", acti2); + scanf("%s", acti3); + z1 = strcmp(acti1, "zumba"); + b1 = strcmp(acti1, "badminton"); + m1 = strcmp(acti1, "musculation"); + s1 = strcmp(acti1, "squash"); + f1 = strcmp(acti1, "football"); + while(z1 != 0 && b1 != 0 && m1 != 0 && s1 != 0 && f1 != 0) + { + printf("Veuillez saisir une activité correcte \n"); + scanf("%s", acti1); + } + z2 = strcmp(acti2, "zumba"); + b2 = strcmp(acti2, "badminton"); + m2 = strcmp(acti2, "musculation"); + s2 = strcmp(acti2, "squash"); + f2 = strcmp(acti2, "football"); + while(z2 != 0 && b2 != 0 && m2 != 0 && s2 != 0 && f2 != 0) + { + printf("Veuillez saisir une activité correcte \n"); + scanf("%s", acti2); + } + z3 = strcmp(acti2, "zumba"); + b3 = strcmp(acti2, "badminton"); + m3 = strcmp(acti2, "musculation"); + s3 = strcmp(acti2, "squash"); + f3 = strcmp(acti2, "football"); + while(z3 != 0 && b3 != 0 && m3 != 0 && s3 != 0 && f3 != 0) + { + printf("Veuillez saisir une activité correcte \n"); + scanf("%s", acti3); + } + + //première activité + if (z1 == 0) + { + numacti = 5; + if (ptsbought < 5) + { + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (b1 == 0) + { + numacti = 1; + if (ptsbought < 8) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 8; + ptsbonus += 8; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (s1 == 0) + { + numacti = 4; + if (ptsbought < 10) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 10; + ptsbonus += 10; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (f1 == 0) + { + numacti = 3; + if (ptsbought < 5) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (m1 == 0) + { + numacti = 2; + if (ptsbought < 15) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 15; + ptsbonus += 15; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + + + + + //deuxième activité + if (z2 == 0) + { + numacti += 5*10; + if (ptsbought < 5) + { + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (b2 == 0) + { + numacti += 1*10; + if (ptsbought < 8) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 8; + ptsbonus += 8; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (s2 == 0) + { + numacti += 4*10; + if (ptsbought < 10) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 10; + ptsbonus += 10; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (f2 == 0) + { + numacti += 3*10; + if (ptsbought < 5) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (m2 == 0) + { + numacti += 2*10; + if (ptsbought < 15) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 15; + ptsbonus += 15; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + + + //troisième activités + if (z3 == 0) + { + numacti += 5*100; + if (ptsbought < 5) + { + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (b3 == 0) + { + numacti += 1*100; + if (ptsbought < 8) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 8; + ptsbonus += 8; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (s3 == 0) + { + numacti += 4*100; + if (ptsbought < 10) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 10; + ptsbonus += 10; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (f3 == 0) + { + numacti += 3*100; + if (ptsbought < 5) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 5; + ptsbonus += 5; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + if (m3 == 0) + { + numacti += 2*100; + if (ptsbought < 15) + printf("Pas assez de points disponibles sur la carte, rechargement souhaité ? (O/N)\n"); + scanf("%c%*c", &recharge); + if (recharge == 'N') + { + return; + } + else + { + //RELOAD AND CONTINUE + return; + } + ptsbought -= 15; + ptsbonus += 15; + if (ptsbonus >= 100) + { + ptsbought += 15; + ptsbonus -= 100; + } + } + } + + +printf("%d", numacti); + return; }