Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.93 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5.  
  6.  
  7. int
  8. main ()
  9. {
  10.  
  11.  
  12. FILE * arq;
  13.  
  14. arq = fopen ("jogoZerinhoouUm.txt", "w");
  15.  
  16.  
  17. if (arq == NULL)
  18.     {
  19.      
  20. printf ("Erro na criaC'C#o do arquivo.\n");
  21.      
  22.  
  23. return 0;
  24.    
  25. }
  26.  
  27.  
  28.  
  29. int n, i, a, b, c;
  30.  
  31. char stri[51];
  32.  
  33.  
  34. fscanf (arq, "%d", &n);
  35.  
  36.  
  37.  
  38. for (i = 0; i < n; i++)
  39.     {
  40.      
  41.  
  42. fscanf (arq, "%d %d %d", &a, &b, &c);
  43.    
  44.  
  45. }
  46.  
  47.  
  48. fscanf (arq, "%s", stri);
  49.  
  50.  
  51.  
  52. for (i = 0; i < n; i++)
  53.     {
  54.      
  55. if (a != (b == c))
  56.     {
  57.      
  58. printf ("%d - %d - %d -> %d", a, b, c, a);
  59.    
  60. }
  61.      
  62.       else
  63.      
  64. if (b != (a == c))
  65.     {
  66.      
  67. printf ("%d - %d - %d -> %d", a, b, c, b);
  68.    
  69. }
  70.      
  71.  
  72.       else
  73.      
  74. if (c != (a == b))
  75.     {
  76.      
  77. printf ("%d - %d - %d -> %d", a, b, c, c);
  78.    
  79. }
  80.      
  81.       else
  82.    
  83.  
  84. printf ("%d - %d - %d -> *", a, b, c);
  85.    
  86.  
  87. }
  88.  
  89.  
  90. fclose (arq);
  91.  
  92. return 0;
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement