Advertisement
Guest User

Untitled

a guest
May 26th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define MIN 50
  5. #define MAX 250
  6.  
  7. #define qtd_alunos 2
  8.  
  9. typedef struct {
  10.     char _nomes[MIN][MAX];
  11. }_alunos;
  12.  
  13. void imprimir(const char name[MIN][MAX])
  14. {
  15.    
  16.     int y;
  17.     for(y=0; y <=qtd_alunos; y++){
  18.         printf("%s \n",name[y]);
  19.     }
  20. }
  21.  
  22. void matricula()
  23. {
  24.     int qtd=2,y;
  25.     _alunos *a = (_alunos *) malloc(sizeof(_alunos));
  26.    
  27.     if (a == NULL)
  28.     {
  29.         printf("\n Ocorreu Algum Erro\n ");
  30.         return;
  31.     }else {
  32.        
  33.         for(y=0; y <= qtd_alunos; y++){
  34.             printf("\n Digite os nomes: ");
  35.             scanf("%s",a->_nomes[y]);
  36.         }
  37.     }
  38.    
  39.    
  40.    
  41. }
  42.  
  43. int main()
  44. {
  45.     int opc;
  46.    
  47.    
  48.     for(;;){
  49.         printf("\n digite opc: ");
  50.         scanf("%d",&opc);
  51.    
  52.         switch(opc){
  53.             case 1:
  54.                 matricula();
  55.                 break;
  56.             case 2:
  57.                 pesquisa();
  58.                 break;
  59.             default:
  60.                 break;
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement