Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <ctype.h>
- #include <string.h>
- #include <stdlib.h>
- #include "TADTxt.h"
- #define LIM 101
- char Menu(void)
- {
- system("cls");
- printf("\t\tMENU\n\n");
- printf("\t\t[A] - Exibir Arquivo\n");
- printf("\t\t[B] - Comparar Arquivos\n");
- printf("\t\t[C] - Transformar letras do arquivo para maiusculas\n");
- printf("\t\t[D] - Contador de letras\n");
- printf("\t\t[E] - Gerar apostas\n");
- printf("\t\t[F] - Ler apostas\n");
- printf("\t\t[G] - Criptografar arquivo\n");
- printf("\t\t[H] - Descriptografar arquivo\n");
- printf("\t\t[I] - Quantdade de palavras iniciadas por vogal\n");
- printf("\t\t[ESC] - Sair");
- printf(" ");
- return toupper(getche());
- }
- void Executa(void)
- {
- int i, res, Dezenas[5];
- char Op, NArq1[LIM], NArq2[LIM], Letra, Palavra1[100];
- char Sub[100];
- Op = Menu();
- while(Op != 27)
- {
- printf("\n\n\n");
- switch(Op)
- {
- case 'A':
- printf("Digite o nome do arquivo:\n");
- fflush(stdin);
- gets(NArq1);
- LeArquivo(NArq1);
- break;
- case 'B':
- printf("Digite o nome do primeiro arquivo:\n");
- fflush(stdin);
- gets(NArq1);
- printf("Digite o nome do segundo arquivo:\n");
- fflush(stdin);
- gets(NArq2);
- res = ComparaArquivos(NArq1, NArq2);
- if(res == -1)
- printf("Dados invalidos\n");
- else if(res == 0)
- printf("Arquivos diferentes\n");
- else
- printf("Arquivos iguais\n");
- break;
- case 'C':
- printf("Digite o nome do arquivo:\n");
- fflush(stdin);
- gets(NArq1);
- ArquivoMaiusculas(NArq1);
- break;
- case 'D':
- printf("Digite o nome do arquivo:\n");
- fflush(stdin);
- gets(NArq1);
- printf("Digite a palavra a ser substituida:\n");
- fflush(stdin);
- gets(Palavra1);
- printf("Digite a palavra substituta:\n");
- fflush(stdin);
- gets(Sub);
- SubstituiFgets(NArq1, Palavra1, Sub);
- break;
- case 'E':
- printf("Digite o nome do arquivo:\n");
- fflush(stdin);
- gets(NArq1);
- GeraAposta(NArq1);
- break;
- case 'F':
- printf("Digite o nome do arquivo:\n");
- fflush(stdin);
- gets(NArq1);
- for(i = 0; i < 5; i++)
- {
- printf("Digite a %da dezena sorteada:\n", i + 1);
- scanf("%d", &Dezenas[i]);
- }
- LeApostas(NArq1, Dezenas);
- break;
- case 'G':
- printf("Digite o nome do arquivo:\n");
- fflush(stdin);
- gets(NArq1);
- CriptografaArquivo(NArq1);
- break;
- case 'H':
- printf("Digite o nome do arquivo:\n");
- fflush(stdin);
- gets(NArq1);
- DescriptografaArquivo(NArq1);
- break;
- default:
- printf("Opcao invalida\n\n");
- }
- getch();
- Op = Menu();
- }
- }
- int main(void)
- {
- Executa();
- return 0;
- }
Add Comment
Please, Sign In to add comment