Doubt about records in C

Asked

Viewed 70 times

0

Hello I have a doubt in this exercise in the last sentence, this asking to make a list but n says it is to put in the record but I am putting the list inside the record to save but n know if this is to do.

  1. Develop an algorithm to manage students in a course. You need to store information about students and subjects. About subjects, it is necessary to store a list of them, containing their name, name of the teacher, workload (30 or 60) and weekly schedule. The list of disciplines to be used can be found at the end of this document, in the "Resources" section. They will not be modified during the execution of the program. As for the schedules, to simplify, the classes take place only on weekdays and are organized in blocks of 2 hours. A discipline can have one or two blocks per week. Each day of the week has 4 blocks. Block 1 always occurs at 8:00 and Block 2 occurs at 10:00 in the morning. Block 3 occurs at 1:00 and Block 4 at 3:00. For example, the discipline of algorithms occurs on Tuesdays and Thursdays. In the second block of Tuesdays and in the third of Thursdays. Consequently, algorithms will be given at 10:00 on Tuesday and 13:00 on Thursday. As for the students, store a list of them, for each student must contain: enrollment, name, surname, email, list of enrolled subjects (only the current semester) and schedule (created based on the blocks explained above). For the lists of students, disciplines and disciplines enrolled in the student, vectors must be used. To store the student’s schedule, it is necessary to use matrices. For student face and discipline, it is necessary to use records.

Code:

#include <stdio.h>
#include <string.h>

    struct diciplinas
    {

    int codigo;
    char nome[20];
    char professor[20];
    int c_Horaria;
    char h_Semanal[30]; 



    };

    struct registro
    {

    int matricula;
    char nome[20];
    char sobrenome[20];
    char email[20];
    int l_Diciplinas[5];

    };


void add_Aluno(struct registro al[3], struct diciplinas add_Dis[5]){
    char sairm;
    int dis,x,y=0,guarda[5];
    printf("\n\n");
    printf("--------------------------------------\n");
    printf("---Voce selecionou adicionar aluno.---\n");
    printf("--------------------------------------\n");
    printf("Lista de diciplinas\n");
                //mostra a lista das materias
    for(x=0; x<3; x++){
        printf("Digite seu nome:");
        fflush(stdin);
        gets(al[x].nome);
        printf("Digite seu Sobrenome:");
        gets(al[x].sobrenome);
        strcat(al[x].nome,al[x].sobrenome);
        printf("Digite sua Matricula:");
        scanf("%d",&al[x].matricula);
        printf("Digite seu e-mail:");
        gets(al[x].email);
        printf("Digite O codigo das diciplinas que voce deseja se matricular\n");
        for(y=0; y<5; y++){
        scanf("%d",&al[x].l_Diciplinas);
}

        }   
    }






main(){

    struct diciplinas curso[5];
    struct registro alunos[3];
    int escolha;
    char grade[5][5];
    curso[0].codigo=122;
    strcpy(curso[0].nome,"Algoritimos");
    curso[0].c_Horaria=60;
    strcpy(curso[0].h_Semanal,"Segunda bloco 1 e terca bloco 2");

    curso[1].codigo=127;
    strcpy(curso[1].nome,"Estrutura de dados");
    curso[1].c_Horaria=60;
    strcpy(curso[1].h_Semanal,"terca bloco 3 e quarta bloco 4");

    curso[2].codigo=132;                                                //dados salvos
    strcpy(curso[2].nome,"Sistemas Operacionais A ");
    curso[2].c_Horaria=60;
    strcpy(curso[2].h_Semanal,"Terca bloco 3 e Quinta bloco 2");

    curso[3].codigo=143;
    strcpy(curso[3].nome,"Padroes de Projeto");
    curso[3].c_Horaria=30;
    strcpy(curso[3].h_Semanal,"Sexta bloco 2");

    curso[4].codigo=135;
    strcpy(curso[4].nome,"Banco de dados ll");
    curso[4].c_Horaria=60;
    strcpy(curso[4].h_Semanal,"Quarta bloco 3 e sexta bloco 2");

    grade[0][0]="Segunda";



    printf(" -----------------------\n");
    printf(" ------Bem Vindo!!------\n");
    printf(" -----------------------\n");
    printf("Escolha uma das opcoes abaixo\n");
    printf("1. Adicionar aluno\n");
    printf("2. Consultar aluno\n");
    scanf("%d",&escolha);
    if(escolha == 1){
        add_Aluno(alunos,curso);
      }else if(escolha == 2){

    }


}
  • I have read the entire statement but I do not understand what you mean by using records. Alias I’ve never heard of records in C. Only thing I see that has some link are variable type register. Does it not refer to struct record? If that’s what your title is confused with, you can understand which record would be a C language ability.

  • 1

    You are right struct for some reason call registration here. But I have already solved the problem

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.