SHARE
TWEET

Untitled

a guest Feb 16th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /*
  8.  * File:   main.c
  9.  * Author: mnunes
  10.  *
  11.  * Created on 29 de Janeiro de 2019, 16:38
  12.  */
  13.  
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17.  
  18. /*
  19.  *
  20.  */
  21. int main(int argc, char** argv) {
  22.    
  23.     struct
  24.     {
  25.         int idTurma;
  26.         char *alunos;
  27.     } Turma;
  28.    
  29.     char *alunoLista;
  30.     int qtd, idTurma;
  31.     char aluno[40];
  32.    
  33.     printf("\t\tPrograma para adicionar a turma e os seus alunos\t\t\n\n");  
  34.    
  35.     printf("Qual o numero da turma?\n");
  36.     scanf("%d", &idTurma);
  37.    
  38.     printf("Quantos alunos a turma %d tem?\n", idTurma);
  39.     scanf("%d",&qtd);
  40.    
  41.     alunoLista = malloc(sizeof(aluno));
  42.  
  43.     for(int i=0;i<qtd;i++)
  44.     {
  45.         printf("Digite o Nome do Aluno: \n");
  46.         gets(aluno);
  47.        
  48.         alunoLista[i] = aluno;
  49.        
  50.     }
  51.        
  52.    
  53.     Turma.idTurma = idTurma;
  54.     Turma.alunos = alunoLista;
  55.    
  56.  
  57.    
  58.     return (EXIT_SUCCESS);
  59. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top