Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct colegio
- {
- int matricula, nota1, nota2, nota3;
- char nome[15], curso[20];
- };
- int cadastro(struct colegio vet[]){
- int i;
- for(i=0; i<2; i++){
- printf("Informe o nΒΊ de matricula desejada:\n"); scanf("%d", &vet[i].matricula);
- printf("Informe seu nome:\n"); scanf("%s", &vet[i].nome);
- printf("Informe seu curso:\n"); scanf("%s", &vet[i].curso);
- printf("Informe your first nota:\n"); scanf("%d", &vet[i].nota1);
- printf("Informe your second nota:\n"); scanf("%d", &vet[i].nota2);
- printf("Informe your third nota:\n"); scanf("%d", &vet[i].nota3);
- }
- }
- int consulta(struct colegio vet[]){
- int i, con;
- printf("Informe a matricula que deseja consultar:"); scanf("%d", &con);
- for(i=0; i<2; i++){
- if(con == vet[i].matricula){
- printf("%s\n", vet[i].nome);
- printf("%s\n", vet[i].curso);
- printf("%d\n", vet[i].nota1);
- printf("%d\n", vet[i].nota2);
- printf("%d\n", vet[i].nota3);
- } else {
- printf("Matricula invalida!");
- }
- }
- }
- int theBest(struct colegio vet[]){
- int i, maior=0;
- for(i=0; i<2; i++){
- // if(maior<vet[i].nota1)
- }
- }
- int media(struct colegio vet[]){
- int i, nota;
- for(i=0; i<2; i++){
- nota = vet[i].nota1 + vet[i].nota2 + vet[i].nota3;
- printf("\n%d\n", vet[i].matricula);
- printf("%s\n", vet[i].nome);
- printf("%s\n", vet[i].curso);
- printf("%d", nota);
- }
- }
- main(){
- int opcao, i, veto[2];
- struct colegio
- {
- int matricula, nota1, nota2, nota3;
- char nome[15], curso[20];
- }vetor[2];
- printf("############### - Colegio Nossa Senhora dos Pecados - ############### \n");
- printf("1 - Cadastrar \n");
- printf("2 - Exibir todos os alunos \n");
- printf("3 - Consulta \n");
- printf("4 - Best student \n");
- printf("5 - Media dos alunos \n");
- scanf("%d", &opcao);
- while(opcao != 6){
- switch(opcao){
- case 1:
- cadastro(vetor);
- break;
- case 2:
- for(i=0; i<2; i++){
- printf("\n%d\n", vetor[i].matricula);
- printf("%s\n", vetor[i].nome);
- printf("%s\n", vetor[i].curso);
- printf("%d\n", vetor[i].nota1);
- printf("%d\n", vetor[i].nota2);
- printf("%d\n", vetor[i].nota3);
- }
- break;
- case 3:
- consulta(vetor);
- break;
- case 4:
- theBest(vetor);
- break;
- case 5:
- media(vetor);
- break;
- }
- printf("\n1 - Cadastrar\n");
- printf("2 - Exibir todos os alunos\n");
- printf("3 - Consulta\n");
- printf("4 - Best student\n");
- printf("5 - Media dos alunos\n");
- scanf("%d", &opcao);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement