Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.33 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include <math.h>
  6. #include <limits.h>
  7.  
  8. typedef int *TABLEAU;
  9. typedef int bool;
  10. #define TRUE 1
  11. #define FALSE 0
  12. #define N 10 //n EXPERIENCES
  13.  
  14.  
  15. #define CODE_TRI_INSERTION 0
  16. #define CODE_TRI_BULLE 1
  17. #define CODE_TRI_RAPIDE 2
  18. #define CODE_TRI_FUSION 3
  19. #define CODE_TRI_TAS 4
  20. #define CODE_TRI_BASE 5
  21. #define CODE_TRI_RAPIDE_RANDOM 6
  22. #define CODE_TRI_RAPIDE_ORIGINAL 7
  23.  
  24.  
  25.  
  26. /******* créer aleatoirement un tableau de nb_elts entiers compris entre 0 et val_max-1 *****/
  27. TABLEAU generer_tableau(int nb_elts, int val_max)
  28. {
  29. int i;
  30. TABLEAU t=NULL;
  31. t=malloc(nb_elts*sizeof(int));
  32. for (i=0;i<nb_elts;i++)
  33. t[i]=(rand()%val_max);
  34. return t;
  35. }
  36.  
  37. /******** afficher un tableau *********/
  38. void affiche_tableau(TABLEAU t, int nb_elts){
  39. int i;
  40. for (i=0;i<nb_elts;i++)
  41. printf("t[%d]= %d \n",i,t[i]);
  42. printf("\n");
  43. return;
  44. }
  45. /* crée une copie d'un tableau */
  46. TABLEAU recopie(TABLEAU t, int nb_elts)
  47. {
  48. TABLEAU tc=NULL;
  49. tc=malloc(nb_elts*sizeof(int));
  50. int i ;
  51. for(i=0; i<nb_elts;i++)
  52. tc[i]=t[i];
  53.  
  54. return tc ;
  55. }
  56.  
  57. /**************************Tri_Insertion***********************/
  58. /******Insert******/
  59. void insertion(TABLEAU t, int dernier_indice, int x){
  60. int i=dernier_indice;
  61. while (i>=0 && t[i]>x)
  62. {
  63. // shift: Elements > x
  64. t[i+1]=t[i];
  65. i--;
  66. }
  67. // In all cases, i+1 : indecates where to insert x
  68. t[i+1]=x;
  69. return ;
  70. }
  71.  
  72. /*****tri par insertion*****/
  73. void triParInsertion(TABLEAU t, int nb_elts){
  74. int j;
  75. for (j=1;j<nb_elts;j++)
  76. // here we have to insert t[j] in t[0..j-1]
  77. insertion(t,j-1,t[j]);
  78. }
  79.  
  80. /***************************SWAP version1******************************/
  81. void permuter(TABLEAU t, int i, int j){
  82. int temp=t[i];
  83. t[i]=t[j];
  84. t[j]=temp;
  85. return;
  86. }
  87. /*********swap version 2********/
  88. void swap(TABLEAU a, TABLEAU b)
  89. {
  90. TABLEAU x = a;
  91. a = b;
  92. b = x;
  93. return;
  94. }
  95. /**********************tri_bulle********************************/
  96. void triBulle(TABLEAU t, int nb_elts)
  97. {
  98. int end=FALSE;
  99. int i;
  100. while (!end)
  101. {
  102. end=TRUE;
  103. for (i=0;i<nb_elts-1;i++)
  104. if (t[i]>t[i+1])
  105. {
  106. permuter(t,i,i+1);
  107. end=FALSE;
  108. }
  109. nb_elts--;
  110. }
  111. }
  112. /*********************Quick_Sort***************************/
  113. void trirapide (TABLEAU tableau, int taille) {
  114. int mur, courant, pivot, tmp;
  115. if (taille < 2) return;
  116. // On prend comme pivot l element le plus a droite
  117. pivot = tableau[taille - 1];
  118. mur = courant = 0;
  119. while (courant<taille) {
  120. if (tableau[courant] <= pivot) {
  121. if (mur != courant)
  122. {
  123. tmp=tableau[courant];
  124. tableau[courant]=tableau[mur];
  125. tableau[mur]=tmp;
  126. }
  127. mur ++;
  128. }
  129. courant ++;
  130. }
  131. trirapide(tableau, mur - 1);
  132. trirapide(tableau + mur - 1, taille - mur + 1);
  133. return;
  134. }
  135. /***************randomized pivot quicksort************/
  136. int random_partition(TABLEAU arr, int start, int end)
  137. {
  138. srand(time(NULL));
  139. int pivotIdx = start + rand() % (end-start+1);
  140. int pivot = arr[pivotIdx];
  141. permuter(arr,pivotIdx,end); // move pivot element to the end
  142. pivotIdx = end;
  143. int i = start -1;
  144. for(int j=start; j<=end-1; j++)
  145.  
  146. {
  147. if(arr[j] <= pivot)
  148. {
  149. i = i+1;
  150. permuter(arr,i, j);
  151. }
  152. }
  153. permuter(arr,i+1,pivotIdx);
  154. return i+1;
  155. }
  156.  
  157. void random_quick_sort(TABLEAU arr, int start, int end)
  158. {
  159. if(start < end)
  160. {
  161. int mid = random_partition(arr, start, end);
  162. random_quick_sort(arr, start, mid-1);
  163. random_quick_sort(arr, mid+1, end);
  164. }
  165. return;
  166. }
  167. /************************quick_sort version original*****************/
  168. int partition2( TABLEAU a, int l, int r) {
  169. int pivot, i, j, t;
  170. pivot = a[l];
  171. i = l; j = r+1;
  172.  
  173. while( 1)
  174. {
  175. do ++i; while( a[i] <= pivot && i <= r );
  176. do --j; while( a[j] > pivot );
  177. if( i >= j ) break;
  178. t = a[i]; a[i] = a[j]; a[j] = t;
  179. }
  180. t = a[l]; a[l] = a[j]; a[j] = t;
  181. return j;
  182. }
  183. void quick__Sort( TABLEAU a, int l, int r)
  184. {
  185. int j;
  186. if( l < r )
  187. {
  188. // divide and conquer
  189. j = partition2( a, l, r);
  190. quick__Sort( a, l, j-1);
  191. quick__Sort( a, j+1, r);
  192. }
  193. return;
  194. }
  195.  
  196. /****************************Merge_Sort******************************/
  197.  
  198. void fusion(TABLEAU tableau,int deb1,int fin1,int fin2)
  199. {
  200. TABLEAU table1=NULL;
  201. int deb2=fin1+1;
  202. int compt1=deb1;
  203. int compt2=deb2;
  204. int i;
  205.  
  206. table1=malloc((fin1-deb1+1)*sizeof(int));
  207.  
  208. //We recopies elements from the biginning of the array
  209. for(i=deb1;i<=fin1;i++)
  210. {
  211. table1[i-deb1]=tableau[i];
  212. }
  213.  
  214. for(i=deb1;i<=fin2;i++)
  215. {
  216. if (compt1==deb2) //All the elements of the first array have been used
  217. {
  218. break; //all the elements have been closed
  219. }
  220. else if (compt2==(fin2+1)) //All the elements of the Second array have been used
  221. {
  222. tableau[i]=table1[compt1-deb1]; //We add the remaining elements of the first array
  223. compt1++;
  224. }
  225. else if (table1[compt1-deb1]<tableau[compt2])
  226. {
  227. tableau[i]=table1[compt1-deb1]; //We add an element of the first array
  228. compt1++;
  229. }
  230. else
  231. {
  232. tableau[i]=tableau[compt2]; //We add an element of the second array
  233. compt2++;
  234. }
  235. }
  236. free(table1);
  237. return;
  238. }
  239.  
  240.  
  241. void tri_fusion_bis(TABLEAU tableau,int deb,int fin)
  242. {
  243. if (deb!=fin)
  244. {
  245. int milieu=(fin+deb)/2;
  246. tri_fusion_bis(tableau,deb,milieu);
  247. tri_fusion_bis(tableau,milieu+1,fin);
  248. fusion(tableau,deb,milieu,fin);
  249. }
  250. return;
  251. }
  252.  
  253. void tri_fusion(TABLEAU tableau,int nb_elts)
  254. {
  255. if (nb_elts>0)
  256. {
  257. tri_fusion_bis(tableau,0,nb_elts-1);
  258. }
  259. return;
  260. }
  261. /************************HEAP_Sort*************************/
  262.  
  263. /************domine****************/
  264. char domine( TABLEAU tab, int taille, int j )
  265. {
  266. if( 2*(j+1)-1 >= taille) /* tab[j] est seul */
  267. return TRUE;
  268.  
  269. else if(2*(j+1)-1 == taille-1 && tab[j] >= tab[2*(j+1)-1]) /* tab[j] a 1 descendant et domine */
  270. return TRUE;
  271.  
  272. else if(tab[j] >= tab[2*(j+1)-1] && tab[j] >= tab[2*(j+1)]) /* tab[j] a 2 descendants et domine */
  273. return TRUE;
  274.  
  275. return FALSE; /* Dans le cas ou tab[j] n'est pas seul et ne domine pas */
  276. }
  277. /*********retablirtas********************/
  278. void retablirTas( TABLEAU tab, int j, int taille )
  279. {
  280. while(!domine(tab, taille, j)){/* I(j) et j domine => tab[0...taille-1] est un tas.*/
  281.  
  282. if( 2*(j+1) == taille){ /* degre 1 && I(2(j+1)-1) */
  283. swap(&tab[j], &tab[ 2*(j+1)-1 ]);
  284. j = 2*(j+1)-1;
  285. }
  286.  
  287. else{ /* degre 2 */
  288. if( tab[ 2*(j+1)-1 ] >= tab[ 2*(j+1) ] ){ /* I(2(j+1)-1) */
  289. swap( &tab[ 2*(j+1)-1 ], &tab[j] );
  290. j = 2*(j+1)-1; /* I(j) */
  291. }
  292.  
  293. else{ /*I(2*(j+1)) */
  294. swap(&tab[ 2*(j+1) ], &tab[j]);
  295. j = 2*(j+1); /* I(j) */
  296. }
  297. }
  298. }
  299. return;
  300. }
  301. /*************MAKE_HEAP****************/
  302. void faireTas(TABLEAU tab, int taille)
  303. {
  304. int k;
  305. for(k = taille-1; k >= 0; k--)
  306. retablirTas(tab, k, taille);
  307. return;
  308. }
  309. /********TRIPARTAS***************/
  310. void tripartas(TABLEAU t,int taille)
  311. {
  312. int f = taille;
  313. faireTas(t, taille);
  314. /* I(f) = tab[0 ... f-1] est un tas
  315. && ensemble des elements de tab[0 ... f-1] inferieur ou egal
  316. a ensemble des elements tab[f ... taille-1]
  317. && tab[f ... taille-1] est trie croissant
  318. */
  319. while ( f > 1){ /* I(k) && (k>1)*/
  320. swap(&t[0], &t[f-1]);
  321. retablirTas(t, 0, f-1); /* I(k-1) */
  322. f--;
  323. }
  324. return;
  325. }
  326. /*********************Radix_sort(tri par base)******/
  327. int getMax(TABLEAU arr, int nb_elts) {
  328. int i, max;
  329. max = arr[0];
  330. for(i = 1; i < nb_elts; i++)
  331. {
  332. if(arr[i] > max) {
  333. max = arr[i];
  334. }
  335. }
  336. return max;
  337. }
  338. void countSort(TABLEAU arr, int n, int exp)
  339. {
  340. int output[n]; // output array
  341. int i, count[10] = {0};
  342.  
  343. // Store count of occurrences in count[]
  344. for (i = 0; i < n; i++)
  345. count[ (arr[i]/exp)%10 ]++;
  346.  
  347. // Change count[i] so that count[i] now contains actual
  348. // position of this digit in output[]
  349. for (i = 1; i < 10; i++)
  350. count[i] += count[i - 1];
  351.  
  352. // Build the output array
  353. for (i = n - 1; i >= 0; i--)
  354. {
  355. output[count[ (arr[i]/exp)%10 ] - 1] = arr[i];
  356. count[ (arr[i]/exp)%10 ]--;
  357. }
  358.  
  359. // Copy the output array to arr[], so that arr[] now
  360. // contains sorted numbers according to current digit
  361. for (i = 0; i < n; i++)
  362. arr[i] = output[i];
  363. }
  364.  
  365. void radixSort(TABLEAU arr, int n) {
  366.  
  367. // Find the maximum number to know number of digits
  368. int m = getMax(arr, n);
  369.  
  370. // Do counting sort for every digit. Note that instead
  371. // of passing digit number, exp is passed. exp is 10^i
  372. // where i is current digit number
  373. for (int exp = 1; m/exp > 0; exp *= 10)
  374. countSort(arr, n, exp);
  375. }
  376. /********************fonction de test*********************/
  377. char test(int nb_elts, int code_tri)
  378. {
  379. TABLEAU t=malloc(nb_elts*sizeof(int));
  380. TABLEAU s=malloc(nb_elts*sizeof(int));
  381. int i,j,v=0,aux;
  382. for (i=0;i<nb_elts;i++)
  383. s[i]=t[i]=(rand()%2?v:v++);
  384. for (i=0;i<nb_elts;i++)
  385. {
  386. j=rand()%nb_elts;
  387. aux=s[i];s[i]=s[j];s[j]=aux;
  388. }
  389. switch (code_tri)
  390. {
  391. case CODE_TRI_INSERTION:
  392. triParInsertion(s, nb_elts);break;
  393. case CODE_TRI_BULLE:
  394. triBulle(s, nb_elts);break;
  395. case CODE_TRI_RAPIDE:
  396. trirapide(s, nb_elts);break;
  397. case CODE_TRI_FUSION:
  398. tri_fusion(s, nb_elts);break;
  399. case CODE_TRI_TAS:
  400. tripartas(s, nb_elts);break;
  401. case CODE_TRI_BASE:
  402. radixSort(s, nb_elts);break;
  403. case CODE_TRI_RAPIDE_RANDOM:
  404. random_quick_sort(s,0, nb_elts-1);break;
  405. case CODE_TRI_RAPIDE_ORIGINAL:
  406. quick__Sort(s,0,nb_elts-1);break;
  407. }
  408. int res = 1;
  409. for (i=0; i<nb_elts; i++)
  410. if (t[i] != s[i])
  411. {
  412. res = 0;
  413. break;
  414. }
  415. free(s);
  416. free(t);
  417. return res;
  418. }
  419. /***********************display**********************/
  420. void DISPLAY()
  421. {
  422. printf("en cours");
  423. return;
  424. }
  425. /***************** affiche_nom_tri(code)****************/
  426. void affiche_nom_tri(int code)
  427. {
  428. switch (code)
  429. {
  430. case 0:
  431. printf("CODE_TRI_INSERTION \n");break;
  432. case 1:
  433. printf("CODE_TRI_BULLE \n");break;
  434. case 2:
  435. printf("CODE_TRI_RAPIDE\n");break;
  436. case 3:
  437. printf("CODE_TRI_FUSION \n");break;
  438. case 4:
  439. printf("CODE_TRI_TAS\n");break;
  440. case 5:
  441. printf("CODE_TRI_BASE\n");break;
  442. }
  443. return;
  444. }
  445. void determinertri(TABLEAU s , int code, int nb_elts)
  446. {
  447. switch (code)
  448. {
  449. case 0:
  450. triParInsertion(s, nb_elts);break;
  451. case 1:
  452. triBulle(s, nb_elts);break;
  453. case 2:
  454. trirapide(s, nb_elts);break;
  455. case 3:
  456. tri_fusion(s, nb_elts);break;
  457. case 4:
  458. tripartas(s, nb_elts);break;
  459. case 5:
  460. radixSort(s,nb_elts);break;
  461. }
  462.  
  463. }
  464. /******************************main2****************************************/
  465. /*COMPARAISON DES TEMPS D'ÉXECUTION DES ALGORITHMES DE TRI */
  466.  
  467. void main2()
  468. {
  469.  
  470. /* tableau contenant les résultats ; les lignes sont indexées par les codes des tris et la colonne i correspond à un tableau de taille (i+1)*base_elts */
  471. double resultat[6][10]={{0},{0}};
  472.  
  473. /* initialisation à 0.0 de chaque case du tableau de résultats */
  474.  
  475. int nbExpe=10;
  476. int base_elts=1000;
  477. int nb_elts;
  478. int k , i ;
  479. TABLEAU t,t2;
  480.  
  481. int code;
  482. int fin,deb;
  483. double mesure=0;
  484. srand(time(NULL));
  485. int valMax=100;
  486. /***********************/
  487. for (k=1;k<=10;k++){ // on remplit le tableau par colonne
  488. nb_elts=k*base_elts;
  489. printf("%d \n",k);
  490. /***********************/
  491. for (i=0;i<nbExpe;i++){ // chaque case du tableau contiendra la somme des temps d'exécution de nbExpe expériences
  492. /* un même tableau sera trié successivement par tous les algorithmes */
  493. t=generer_tableau(nb_elts,valMax);
  494. t2=malloc(k*base_elts*sizeof(int));
  495. t2=recopie(t,nb_elts);
  496. for (code=0;code<6;code++){
  497. printf("calcul en cours ne quittez pas \n ");
  498. t=recopie(t2,nb_elts);
  499. deb=clock();
  500. determinertri(t,code,nb_elts);
  501. fin=clock();
  502. mesure=mesure+(double)(fin-deb)/ CLOCKS_PER_SEC;
  503. resultat[code][i]=mesure;
  504.  
  505.  
  506. }
  507. free(t);
  508.  
  509. free(t2);
  510.  
  511. }
  512.  
  513. }
  514. printf("fini");
  515. /* affichage du tableau de résultat */
  516.  
  517. for (code=0;code<6;code++){
  518. affiche_nom_tri(code);
  519. for (k=1;k<=10;k++)
  520. printf("%f ",resultat[code][k-1]/nbExpe);
  521. printf("\n");
  522. }/*fin for1*/
  523. return;
  524. }/*fin main2*/
  525. /**********************principal_program***************/
  526. int main()
  527. {
  528. int h, L =10;
  529. int somme=0;
  530.  
  531.  
  532. int reponse;
  533. printf("**************************LES TRIS***************************\n");
  534. printf(" AIX_MARSEILLE UNIVERSITÉ\n ++Menu++ \n ");
  535. printf("1 : Les details et les differentes parties du programme \n");
  536. printf("\n 2 : COMPARAISON DES TEMPS D'ÉXECUTION DES ALGORITHMES DE TRI\n ");
  537. printf("\n 3 : Application des tri \n");
  538. printf("\n 0 : To EXIT");
  539. printf("\n************PROGRAMME FAIT PAR :TRABELSI Ilef**************\n");
  540. printf("*your ANSWER is :");
  541. scanf("%d",&reponse);
  542. switch (reponse)
  543. {
  544. case 1:
  545. DISPLAY;break;
  546. case 0:exit(0);break;
  547. case 2: main2 ();break;
  548.  
  549. case 3:
  550. {
  551.  
  552.  
  553. int r,debut=0;
  554. do
  555. {
  556. TABLEAU t;
  557. int fin,deb;
  558. srand(time(NULL));
  559. int nb_elts;
  560. printf("le nb_elts = ");
  561. scanf("%d",&nb_elts);
  562. int valMax=100;
  563. /*******tri_insertion***********/
  564. printf("The first array: \n");
  565. t=generer_tableau(nb_elts,valMax);
  566. affiche_tableau(t,nb_elts);
  567. printf("tri par Insertion :\n");
  568. deb=clock();
  569. triParInsertion(t,nb_elts);
  570. fin=clock();
  571. printf("temps d'exécution :%f\n",(double)(fin-deb)/ CLOCKS_PER_SEC);
  572. affiche_tableau(t,nb_elts);
  573. free(t);
  574. /*********tri_à_bulle**********/
  575. printf("the second array \n");
  576. t=generer_tableau(nb_elts,valMax);
  577. affiche_tableau(t,nb_elts);
  578. printf("tri à bulle : \n");
  579. deb=clock();
  580. triBulle(t,nb_elts);
  581. fin=clock();
  582. printf("temps d'exécution :%f\n",(double)(fin-deb)/ CLOCKS_PER_SEC);
  583. affiche_tableau(t,nb_elts);
  584. free(t);
  585. /*********tri_rapide**********/
  586.  
  587.  
  588. printf("the third array \n");
  589. t=generer_tableau(nb_elts,valMax);
  590. affiche_tableau(t,nb_elts);
  591. printf(" tri Rapide : \n");
  592. deb=clock();
  593. trirapide(t,nb_elts);
  594. fin=clock();
  595. printf("temps d'exécution :%f\n",(double)(fin-deb)/ CLOCKS_PER_SEC);
  596. affiche_tableau(t,nb_elts);
  597. free(t);
  598. /********tri_fusion*****/
  599. printf("the fourth array \n");
  600. t=generer_tableau(nb_elts,valMax);
  601. affiche_tableau(t,nb_elts);
  602. printf("tri fusion : \n");
  603. deb=clock();
  604. tri_fusion(t,nb_elts);
  605. fin=clock();
  606. printf("temps d'exécution :%f\n",(double)(fin-deb)/ CLOCKS_PER_SEC);
  607. affiche_tableau(t,nb_elts);
  608. free(t);
  609. /********tri_par_tas*****/
  610. printf("the Fithf array \n");
  611. t=generer_tableau(nb_elts,valMax);
  612. affiche_tableau(t,nb_elts);
  613. printf("tri par tas : \n");
  614. deb=clock();
  615. tripartas(t,nb_elts);
  616. fin=clock();
  617. printf("temps d'exécution :%f\n",(double)(fin-deb)/ CLOCKS_PER_SEC);
  618. affiche_tableau(t,nb_elts);
  619. free(t);
  620. /********tri_par_base*****/
  621. printf("the Sixth array \n");
  622. t=generer_tableau(nb_elts,valMax);
  623. affiche_tableau(t,nb_elts);
  624. printf("tri par base : \n");
  625. deb=clock();
  626. radixSort(t,nb_elts);
  627. fin=clock();
  628. printf("temps d'exécution :%f\n",(double)(fin-deb)/ CLOCKS_PER_SEC);
  629. affiche_tableau(t,nb_elts);
  630. free(t);
  631. /********tri_rapide(RANDOM)*****/
  632.  
  633. printf("the seventh array \n");
  634. t=generer_tableau(nb_elts,valMax);
  635. affiche_tableau(t,nb_elts);
  636. printf(" random_quick_sort : \n");
  637. deb=clock();
  638. random_quick_sort(t,0,nb_elts-1);
  639. fin=clock();
  640. printf("temps d'exécution :%f\n",(double)(fin-deb)/ CLOCKS_PER_SEC);
  641. affiche_tableau(t,nb_elts);
  642. free(t);
  643.  
  644. /********tri_rapide_VERSION_ORIGINAL*****/
  645. printf("the eighth array \n");
  646. t=generer_tableau(nb_elts,valMax);
  647. affiche_tableau(t,nb_elts);
  648. printf("quick_sort_VERSION_ORIGINALE : \n");
  649. deb=clock();
  650. quick__Sort(t,0,nb_elts-1);
  651. fin=clock();
  652. printf("temps d'exécution :%f\n",(double)(fin-deb)/ CLOCKS_PER_SEC);
  653. affiche_tableau(t,nb_elts);
  654. free(t);
  655.  
  656.  
  657. /**********test**********/
  658. printf("LETS test our program \n");
  659. nb_elts=10000;
  660. if(test(nb_elts,CODE_TRI_INSERTION)==1)
  661. printf("Test du tri par insertion :GOOD!! \n");
  662. if(test(nb_elts,CODE_TRI_BULLE)==1)
  663. printf("Test du tri à bulle :GOOD ! \n");
  664. if(test(nb_elts,CODE_TRI_RAPIDE)==1)
  665. printf("Test du tri rapide : GOOD ! \n");
  666. if(test(nb_elts,CODE_TRI_FUSION)==1)
  667. printf("Test du tri fusion : GOOD ! \n");
  668. if(test(nb_elts,CODE_TRI_TAS)==1)
  669. printf("Test du tri par tas : GOOD ! \n");
  670. if(test(nb_elts,CODE_TRI_BASE)==1)
  671. printf("Test du tri par BASE : GOOD ! \n");
  672. if(test(nb_elts,CODE_TRI_RAPIDE_RANDOM)==1)
  673. printf("Test du tri rapide(pivot:random) : GOOD ! \n");
  674. if(test(nb_elts,CODE_TRI_RAPIDE_ORIGINAL)==1)
  675. printf("Test du tri rapide(ORIGINAL) : GOOD ! \n");
  676.  
  677.  
  678.  
  679.  
  680. printf("*********************************************\n");
  681. printf("* Do you wanna exit ? please press 0:yes 1:No \n*Thank you !*\n");
  682. printf("*your ANSWER is :");
  683. scanf("%d",&r);
  684. }/*fin do */
  685. while(r==0);
  686. break;}/*fin case 3*/
  687. }/*finswitch*/
  688. return 0;
  689. }/*fin main*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement