Jvsierra

11

Feb 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.84 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include "TADTxt.h"
  7.  
  8. #define LIM 101
  9.  
  10. char Menu(void)
  11. {
  12.     system("cls");
  13.      
  14.     printf("\t\tMENU\n\n");
  15.      
  16.     printf("\t\t[A] - Exibir Arquivo\n");
  17.     printf("\t\t[B] - Comparar Arquivos\n");
  18.     printf("\t\t[C] - Transformar letras do arquivo para maiusculas\n");
  19.     printf("\t\t[D] - Contador de letras\n");
  20.     printf("\t\t[E] - Gerar apostas\n");
  21.     printf("\t\t[F] - Ler apostas\n");
  22.     printf("\t\t[G] - Criptografar arquivo\n");
  23.     printf("\t\t[H] - Descriptografar arquivo\n");
  24.     printf("\t\t[I] - Quantdade de palavras iniciadas por vogal\n");
  25.     printf("\t\t[ESC] - Sair");
  26.     printf("           ");
  27.     return toupper(getche());
  28. }
  29.  
  30. void Executa(void)
  31. {
  32.     int i, res, Dezenas[5];
  33.     char Op, NArq1[LIM], NArq2[LIM], Letra, Palavra1[100];
  34.     char Sub[100];
  35.      
  36.     Op = Menu();
  37.      
  38.     while(Op != 27)
  39.     {
  40.         printf("\n\n\n");
  41.          
  42.         switch(Op)
  43.         {
  44.             case 'A':
  45.                 printf("Digite o nome do arquivo:\n");
  46.                 fflush(stdin);
  47.                 gets(NArq1);
  48.                  
  49.                 LeArquivo(NArq1);
  50.             break;
  51.             case 'B':
  52.                 printf("Digite o nome do primeiro arquivo:\n");
  53.                 fflush(stdin);
  54.                 gets(NArq1);
  55.                  
  56.                 printf("Digite o nome do segundo arquivo:\n");
  57.                 fflush(stdin);
  58.                 gets(NArq2);
  59.                  
  60.                 res = ComparaArquivos(NArq1, NArq2);
  61.                  
  62.                 if(res == -1)
  63.                     printf("Dados invalidos\n");
  64.                 else if(res == 0)
  65.                     printf("Arquivos diferentes\n");
  66.                 else
  67.                     printf("Arquivos iguais\n");    
  68.             break;
  69.             case 'C':
  70.                 printf("Digite o nome do arquivo:\n");
  71.                 fflush(stdin);
  72.                 gets(NArq1);
  73.                  
  74.                 ArquivoMaiusculas(NArq1);
  75.             break;
  76.             case 'D':
  77.                 printf("Digite o nome do arquivo:\n");
  78.                 fflush(stdin);
  79.                 gets(NArq1);
  80.                
  81.                 printf("Digite a palavra a ser substituida:\n");
  82.                 fflush(stdin);
  83.                 gets(Palavra1);
  84.                
  85.                 printf("Digite a palavra substituta:\n");
  86.                 fflush(stdin);
  87.                 gets(Sub);
  88.                
  89.                 SubstituiFgets(NArq1, Palavra1, Sub);
  90.             break;
  91.             case 'E':
  92.                 printf("Digite o nome do arquivo:\n");
  93.                 fflush(stdin);
  94.                 gets(NArq1);
  95.                  
  96.                 GeraAposta(NArq1);
  97.             break;
  98.             case 'F':
  99.                 printf("Digite o nome do arquivo:\n");
  100.                 fflush(stdin);
  101.                 gets(NArq1);
  102.                  
  103.                 for(i = 0; i < 5; i++)
  104.                 {
  105.                     printf("Digite a %da dezena sorteada:\n", i + 1);
  106.                     scanf("%d", &Dezenas[i]);  
  107.                 }
  108.                
  109.                 LeApostas(NArq1, Dezenas);
  110.             break;
  111.             case 'G':
  112.                 printf("Digite o nome do arquivo:\n");
  113.                 fflush(stdin);
  114.                 gets(NArq1);
  115.                
  116.                 CriptografaArquivo(NArq1);
  117.             break;
  118.             case 'H':
  119.                 printf("Digite o nome do arquivo:\n");
  120.                 fflush(stdin);
  121.                 gets(NArq1);
  122.                
  123.                 DescriptografaArquivo(NArq1);
  124.             break;
  125.             default:
  126.                 printf("Opcao invalida\n\n");  
  127.         }
  128.          
  129.         getch();
  130.          
  131.         Op = Menu();
  132.     }
  133. }
  134.  
  135. int main(void)
  136. {
  137.     Executa();
  138.          
  139.     return 0;
  140. }
Add Comment
Please, Sign In to add comment