Advertisement
justaCprogrammer

justac.c

Feb 16th, 2021
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.43 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<string.h>
  4.  
  5. void apagaFeladaMae(){
  6.     system("cls");
  7. }
  8. int main (){
  9.     int n1,cont,num,resp,y;
  10.     char **pernam;
  11.     y = 1;
  12.     char tempnam[y];
  13.     while(resp != 3){
  14.         printf("=========|Menu de Inicializacao|=========\n");
  15.         printf("======|Escolha uma opcao|======\n");
  16.         printf("======|[1]--Digite um nome|======\n");
  17.         printf("======|[2]--Passar o nome para a matriz permanente|======\n");
  18.         printf("======|[3]--Imprimir a matriz|======\n");
  19.         printf("Escolha a opcao 3 apenas se voce tiver terminado,pois ele encerra o programa\n");
  20.         printf("================================================================\n");
  21.         scanf("%d",&resp);
  22.         if(resp = 1){
  23.           n1 = n1 + 1;
  24.           for(cont = 0;cont<y;cont++){
  25.           printf("Digite um nome\n");
  26.           scanf("%s",&tempnam[cont]);
  27.           }
  28.             }
  29.             if(resp = 2){
  30.             pernam = malloc(n1 * sizeof(char*));
  31.             for(num = 0;num < n1;num++){
  32.               for(cont = 0;cont < y;cont++){
  33.                 pernam[num] = malloc(100);
  34.                 strcpy(tempnam[cont],pernam[num]);
  35.               }
  36.             }
  37.             }
  38.             if(resp = 3){
  39.               fflush(stdin);
  40.               for(num = 0;num < n1;num++){
  41.                 printf("%s",pernam[num]);
  42.               }
  43.             }
  44.           }
  45.  
  46.     return 0;
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement