MouhcineFD

TestMemoireFD

Apr 21st, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.03 KB | None | 0 0
  1. //Tout les droit reserve MouhcineFD
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. void pausesc(int nbresec)
  6. {
  7. clock_t goal;
  8. goal=(nbresec*CLOCKS_PER_SEC)+clock();
  9. while(goal>clock())
  10. ;
  11. }
  12. void attefc(int nbrp)
  13. {
  14. int i;
  15. for(i=nbrp; i>0; i--)
  16. {
  17. printf("%d\n",i);
  18. pausesc(1);
  19. }
  20. system("cls");
  21. }
  22. void initialise(char *tab,char *tabb)
  23. {
  24. int i;
  25. for(i=0; i<6; i++)
  26. tabb[i]=' ';
  27. tabb[6]='\0';
  28. tab[0]=2;
  29. tab[1]=14;
  30. tab[2]=6;
  31. tab[3]=11;
  32. tab[4]=4;
  33. tab[5]=234;
  34. tab[6]=15;
  35. tab[7]=3;
  36. tab[8]=12;
  37. tab[9]=5;
  38. tab[10]=1;
  39. tab[11]=232;
  40. tab[12]='\0';
  41. }
  42. int main()
  43. {
  44. system("title TestMemoire By MouhcineFD");
  45. printf("////////////////////////////////////////////////////////////\n");
  46. printf("////////////////////////////////////////////////////////////\n");
  47. printf("//// Bienvenue Sur TestMemoire Devlopper Par MouhcineFD ////\n");
  48. printf("////////////////////// To Startimes ////////////////////////\n");
  49. printf("////////////////////////////////////////////////////////////\n");
  50. printf("////////////////////////////////////////////////////////////\n\n");
  51. pausesc(3);
  52. int i,a=0,nbrh,j,score=0,vrj=0;
  53. char tab[13],tabb[7],tabc[13];
  54. srand(time(NULL));
  55. initialise(&tab,&tabb);
  56. printf("TEST N 1\nRappelez-vous bien ces symboles !!!\n\n");
  57. for(i=0; i<6; i++)
  58. {
  59. do
  60. {
  61. nbrh=(rand()%(11-0+1))+0;
  62. for(j=0; j<6; j++)
  63. if(tab[nbrh]==tabb[j])
  64. nbrh=100;
  65. }
  66. while(nbrh==100);
  67. tabb[i]=tab[nbrh];
  68. printf(" %c\n",tabb[i]);
  69. }
  70. printf("\n");
  71. attefc(10);
  72. printf("\n");
  73. for(i=0; i<12; i++)
  74. printf(" %d : %c \n",i,tab[i]);
  75. printf("\nEntrez les numeros des symboles que t'ai vu :\n");
  76. for(i=0; i<6; i++)
  77. {
  78. scanf("%d",&nbrh);
  79. for(j=0; j<6; j++)
  80. {
  81. if(tab[nbrh]==tabb[j])
  82. {
  83. printf("Vrai\n");
  84. score+=25;
  85. vrj=1;
  86. a++;
  87. }
  88. }
  89. if(vrj!=1)
  90. {
  91. printf("Faute\n");
  92. score-=25;
  93. }
  94. vrj=0;
  95. }
  96. printf("\nVous avez %d bonnes reponses sur 6.\n\n",a);
  97. system("pause");
  98. a=0;
  99. initialise(&tab,&tabb);
  100. system("cls");
  101. printf("\nTEST N 2\nSouviens tres bien de l'ordre de ces symboles !!!\n\n");
  102. for(i=0; i<6; i++)
  103. {
  104. do
  105. {
  106. nbrh=(rand()%(6-1+1))+1;
  107. for(j=0; j<6; j++)
  108. if(tabb[j]==nbrh)
  109. nbrh=100;
  110. }
  111. while(nbrh==100);
  112. tabb[i]=nbrh;
  113. printf(" %d => %c\n",i+1,tabb[i]);
  114. }
  115. printf("\n");
  116. attefc(15);
  117. printf("\n");
  118. for(i=1; i<=6; i++)
  119. printf(" %d : %c\n",i,i);
  120. printf("\nInserez l'ordre de symbole.\n\n");
  121. for(i=0; i<6; i++)
  122. {
  123. printf(" %d => ",i+1);
  124. scanf("%d",&nbrh);
  125. if(tabb[i]==nbrh)
  126. {
  127. printf("Vrai\n");
  128. score+=50;
  129. a++;
  130. }
  131. else
  132. {
  133. printf("Faute\n");
  134. score-=25;
  135. }
  136. }
  137. printf("\nVous avez %d bonnes reponses sur 6.\n\n",a);
  138. system("pause");
  139. a=0;
  140. initialise(&tab,&tabb);
  141. system("cls");
  142. printf("\nTEST N 3\nRappelez-vous bien le total de ces symboles !!!\n\n");
  143. for(i=0; i<12; i++)
  144. tabc[i]=tab[(rand()%(11-0+1))+0];
  145. tabc[12]='\0';
  146. for(i=0; i<12; i+=3)
  147. printf(" %c + %c = %c\n",tabc[i],tabc[i+1],tabc[i+2]);
  148. printf("\n");
  149. attefc(20);
  150. printf("\n");
  151. for(i=0; i<12; i++)
  152. printf(" %d : %c\n",i,tab[i]);
  153. for(j=0; j<4; j++)
  154. {
  155. do
  156. {
  157. do
  158. {
  159. nbrh=(rand()%(9-0+1))+0;
  160. }
  161. while(nbrh!=0&&nbrh!=3&&nbrh!=6&&nbrh!=9);
  162. }
  163. while(nbrh==tabb[0]||nbrh==tabb[1]||nbrh==tabb[2]||nbrh==tabb[3]);
  164. tabb[j]=nbrh;
  165. }
  166. printf("\n");
  167. printf("\nInserez le total de ces deux symboles :\n\n");
  168. for(j=0; j<4; j++)
  169. {
  170. printf(" %c + %c = ",tabc[tabb[j]],tabc[tabb[j]+1]);
  171. scanf("%d",&vrj);
  172. if(tab[vrj]==tabc[tabb[j]+2])
  173. {
  174. printf("Vrai\n");
  175. score+=100;
  176. a++;
  177. }
  178. else
  179. {
  180. printf("Faute\n");
  181. score-=25;
  182. }
  183. }
  184. printf("\nVous avez %d bonnes reponses sur 4.\n\n",a);
  185. system("pause");
  186. system("cls");
  187. printf("Votre score est : %d\n",score);
  188. system("pause");
  189. system("cls");
  190. printf("////////////////////////////////////////\n");
  191. printf("////////////// MouhcineFD //////////////\n");
  192. printf("//// vous remercions d'avoir choisi ////\n");
  193. printf("////////////// TestMemoire /////////////\n");
  194. printf("////////////////////////////////////////\n");
  195. pausesc(3);
  196. return 0;
  197. }
Advertisement
Add Comment
Please, Sign In to add comment