Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. /*Costea Alessandro
  2. 3A INFO 20/03/2019*/
  3.  
  4. //Programma che riproduce il gioco MasterMind
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8.  
  9. void caricaCodSeg(char vet[],int dim)
  10. {
  11.     int i;
  12.     char car;
  13.    
  14.  
  15.     for(i=0;i<dim;i++)
  16.     {
  17.         car=getche();
  18.         while(car=='B' || car=='G' || car=='V' || car=='R')
  19.         {
  20.             car=getche();
  21.         }
  22.         vet[i]=car;
  23.     }
  24.    
  25. }
  26.  
  27.  
  28.  
  29. int main()
  30. {
  31.  
  32.     char codSeg[4],tent[4];
  33.     int i;
  34.  
  35.     printf("Inserire il codice segreto: ");
  36.     caricaCodSeg(codSeg,4);
  37.     for(i=0;i<4;i++)
  38.     {
  39.         printf("%c",codSeg[i]);
  40.     }
  41.    
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement