Transcript
# include ,,,,,,
# include ,,,,,,
# include ,,,,,,
# include ,,,,,,
# include ,,,,,,
# include ,,,,,,
,,,,,,
struct bancoalunos {,,,,,,
int idade;,,,,,,
int matricula;,,,,,,
float notas[5][2][2]; //Ano, semestre, prova,,,,
float media;,,,,,,
char nome[40];,,,,,,
} alunos[5];,,,,,,
int h,i,j,k,n,w=0,r;
,,,,,,
,,,,,,
,,,,,,
/*******************************************************************************************/,,,,,,
/*Prot tipo de Fun oes*/,,,,,,
void InserirAluno( );,,,,,,
void ExcluirAluno( );,,,,,,
void ModificarAluno( );,,,,,,
void visualizar( );,,,,,,
void menu ();,,,,,,
/*******************************************************************************************/,,,,,,
,,,,,,
main (){,,,,,,
,,,,,,
for(i=0;i<5;i++){,,,,,,
for(h=0;h<5;h++){,,,,,,
for(j=0;j<2;j++){,,,,,,
for(k=0;k<2;k++){,,,,,,
alunos[i].notas[h][j][k]=0;,,,,,,
} ,,,,,,
} ,,,,,,
} ,,,,,,
} //zera notas dos alunos,,,,,,
,,,,,,
,,,,,,
for(i=0;i<5;i++){,,,,,,
alunos[i].idade=0;}//zera idade dos alunos,,,,,,
menu (); ,,,,,,
getch();,,,,,,
,,,,,,
},,,,,,
,,,,,,
,,,,,,
/*******************************************************************************************/,,,,,,
/*Inserir Aluno*/,,,,,,
,,,,,,
void InserirAluno( ){,,,,,,
,,,,,,
int x,e=1,ano,sem,pro,op,op2;
float nota_anterior;,,,,,,
char nome_apagar[5]={0,0,0,0,0};,,
,,,,,,
" if (r==5)printf(""\tBanco de Dados esta cheio!\n"");",,,,,,
,,,,,,
/* Sai quando o nome for sair */,,,,,,
for(r =0; r < 5 ; r++) {,,,,,,
" system(""cls"");",,,,,,
if(alunos[r].idade == 0){,,,,,,
,,,,,,
nota_anterior = 0;,,,,,,
,,,,,,
,,,,,,
/* NOME */,,,,,,
fflush(stdin);,,,,,,
" printf(""\t***************\n"");",,,,,,
" printf(""\t* ALUNO: %i *\n, r+1);
printf(""\t***************\n\n\n"");
printf(""\tDigite o nome:\n\t"");
gets(alunos[r].nome);
fflush(stdin);
if (strcmp(""sair", alunos[r].nome) == 0) break;,,,,,
,,,,,,
/* MATRICULA */,,,,,,
" printf(""\tDigite a matricula:\n\t"");",,,,,,
" scanf(""%i, &alunos[r].matricula);
fflush(stdin);
for(x=0; x< r; x++){
if ( alunos[r].matricula == alunos[x].matricula){
printf(""\tMatricula ja existe!\n\n""); e = 0;}
else { e =2;}}
if ( e == 0 ){ r--;continue;}
/* IDADE */
printf(""\tDigite a idade:\n\t"");
scanf(""%i", &alunos[r].idade);,,,,,
fflush(stdin); ,,,,,,
,,,,,,
,,,,,,
/*Sai quando digita -1*/,,,,,,
,,,,,,
/* NOTAS */,,,,,,
,,,,,,
" printf(""\n\tComo Deseja Inserir as notas?\n \t1-De forma Continua\n \t2-De forma Descontinua\n\n\t"");",,,,,,
" scanf(""%i, &op);
printf(""\n"");
switch(op){
case 1: {
for (h=0; (h < 5) && (nota_anterior != -1);h++){
printf(""\n\tAno: %i\n\n", h+1);,,,,,
,,,,,,
for (j=0;(j < 2) && (nota_anterior != -1);j++){,,,,,,
" printf(""\t#Semestre %i\n, j+1);
for (k=0;(k < 2) && (nota_anterior != -1);k++){
printf(""\tProva %i: ", k+1);,,,,,
" scanf(""%f, &alunos[r].notas[h][j][k]);
nota_anterior = alunos[r].notas[h][j][k];
fflush(stdin);
}
printf(""\t\n"");
}}break;}
case 2: {
for( i=0;i<20;i++){
printf (""\tQual ano?\n\t"");
scanf (""%i", &ano);,,,,,
" printf (""\tQual semestre?\n\t"");",,,,,,
" scanf (""%i, &sem);
printf (""\tQual prova?\n\t"");
scanf (""%i", &pro);,,,,,
" printf(""\tInsira a nota:\n\t""); ",,,,,,
ano = ano-1; sem = sem - 1; pro = pro - 1;,,,,,,
" scanf(""%f, &alunos[r].notas[ano][sem][pro]);
printf (""\n\tDeseja inserir mais notas? \n\t1-Sim\n\t2-Nao\n\t"");
scanf (""%i", &op2);,,,,,
" printf(""\n"");",,,,,,
if (op2 == 2) return;,,,,,,
} ,,,,,,
},,,,,,
},,,,,,
}//if idade difere 0,,,,,,
,,,,,,
,,,,,,
,,,,,,
},,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
for(i=0;i<5;i++){,,,,,,
for(h=0;h<5;h++){,,,,,,
for(j=0;j<2;j++){,,,,,,
for(k=0;k<2;k++){,,,,,,
if(alunos[i].notas[h][j][k] == -1 ){ alunos[i].notas[h][j][k] = 0; } //if,,,,,,
} } },,,,,,
} ,,,,,,
for(i=0;i<5;i++){,,,,,,
,,,,,,
" if (strcmp(""sair, alunos[i].nome) == 0){ strcpy(alunos[i].nome, nome_apagar); } //if
}
}
/*******************************************************************************************/
/*Excluir Aluno*/
void ExcluirAluno( ){
char zerado[5]={0,0,0,0,0}, nome[40];
int mat,op, x =0,y,op2;
w=0;
for(i=0;i<5;i++) {if( alunos[i].idade != 0) {w++;}}
printf(""\t********************************\n"");
printf(""\t* EXCLUIR ALUNO *\n"");
printf(""\t********************************\n\n"");
printf(""\t1 - Matricula\n"");
printf(""\t2 - Nome\n"");
printf(""\t3 - Voltar\n\n\t"");
scanf(""%i", &op);,,,,,
,,,,,,
switch(op){,,,,,,
case 1: {,,,,,,
" system (""cls"");",,,,,,
" printf(""\tMatricula:\n\t"");",,,,,,
" scanf(""%i, &mat);
for(i=0; i<6; i++){//inicio do loop
if( mat == alunos[i].matricula)
{
printf(""\n\tTem certeza? \n\t1 - Sim\n\t2 - Nao\n\n\t"");
scanf(""%i", &op2);,,,,,
,,,,,,
if (op2 == 1)//inicio if sim,,,,,,
{,,,,,,
alunos[i].matricula = 0;,,,,,,
alunos[i].idade = 0;,,,,,,
strcpy (alunos[i].nome, zerado);,,,,,
for (h=0; (h < 5) ;h++){,,,,,,
for (j=0;(j < 2) ;j++){,,,,,,
for (k=0;(k < 2) ;k++){,,,,,,
alunos[i].notas[h][j][k] = 0;,,,,,,
},,,,,,
},,,,,,
},,,,,,
" system(""cls""); ",,,,,,
" printf(""\tAluno foi excluido com sucesso!\n\n"");",,,,,,
ExcluirAluno(); ,,,,,,
}//final if sim,,,,,,
if(op2 == 2)//inicio if nao,,,,,,
{ ,,,,,,
" system(""cls""); ",,,,,,
ExcluirAluno();,,,,,,
}//final if nao,,,,,,
},,,,,,
,,,,,,
" else system(""cls"");",,,,,,
" printf(""\tEssa matricula nao existe\n\n"");",,,,,,
ExcluirAluno( );,,,,,,
} //final do loop,,,,,,
},,,,,,
,,,,,,
case 2: {,,,,,,
" system (""cls"");",,,,,,
" printf(""\tNome:\n\t"");",,,,,,
fflush(stdin);,,,,,,
gets(nome);,,,,,,
for(i=0; i<6; i++){,,,,,,
y = strcmp(nome, alunos[i].nome);,,,,,
if (y==0) {,,,,,,
" printf(""\n\tTem certeza?\n\t1 - Sim\n\t2 - Nao\n\n\t"");",,,,,,
fflush(stdin);,,,,,,
" scanf (""%i, &op2);
fflush(stdin);
if (op2 == 1)
{
alunos[i].matricula = 0;
alunos[i].idade = 0;
strcpy (alunos[i].nome, zerado);
for (h=0; (h < 5) ;h++){
for (j=0;(j < 2) ;j++){
for (k=0;(k < 2) ;k++){
alunos[i].notas[h][j][k] = 0;
}
}
}
system(""cls"");
printf(""\tAluno foi excluido com sucesso!\n\n"");
ExcluirAluno();
}//final if sim
if(op2 == 2)//inicio if nao
{
system(""cls"");
ExcluirAluno();
}//final if nao
}//nome
else system(""cls"");
printf(""\tEsse aluno nao existe!\n\n"");
ExcluirAluno();
}//for
}//case
case 3: {
system(""cls"");
menu(); }
default: system(""cls"");
printf(""\tNao eh opcao!\n"");}
ExcluirAluno();
}
/*******************************************************************************************/
/*Modificar Aluno*/
void ModificarAluno( ){
char nome[40];
int mat,opc,opc2,i,h,j,k,idade, ano,sem,pro,x=0;
float nova;
printf(""\t1- Por matricula\n"");
printf(""\t2- Por nome\n\t"");
scanf(""%i", &opc);,,,,,
,,,,,,
switch(opc){,,,,,,
/*Por matricula*/ ,,,,,,
case 1:,,,,,,
{,,,,,,
" printf(""\tMatricula:\n\t"");",,,,,,
" scanf(""%i, &mat);
for (i=0;i<5;i++){
if (mat == alunos[i].matricula){
printf (""\n\tNome = %s", alunos[i].nome);,,,,,
" printf (""\n\tIdade = %i, alunos[i].idade);
x=1;
break;
}
}
if ( x == 0) {printf (""\tAluno nao encontrado!""); _sleep (2500);return ;}
printf(""\n\n\tO que deseja modificar?\n"");
printf(""\t1- Nome\n"");
printf(""\t2- Idade\n"");
printf(""\t3- Notas\n\t"");
scanf(""%i", &opc2);,,,,,
,,,,,,
,,,,,,
,,,,,,
switch(opc2){,,,,,,
,,,,,,
case 1:,,,,,,
" printf(""\n\tNovo nome:"");",,,,,,
" scanf (""%s, &nome);
strcpy (alunos[i].nome,nome);
//troca o nome
break;
case 2:
printf(""\n\tNova idade:"");
scanf (""%i", &idade);,,,,,
alunos[i].idade= idade;,,,,,,
//troca idade,,,,,,
break;,,,,,,
,,,,,,
case 3:,,,,,,
" printf (""\n\tQual Ano ?"");",,,,,,
" scanf (""%i, &ano);
printf (""\n\tQual Semestre ?"");
scanf (""%i", &sem);,,,,,
" printf (""\n\tQual Prova ?"");",,,,,,
" scanf (""%i, &pro);
printf (""\n\tDigite a nova nota:\n\t"");
scanf (""%f", &nova);,,,,,
ano=ano-1;sem=sem-1;pro=pro-1;,,,,,,
" printf(""\tNota antiga %.2f: \n, alunos[i].notas[ano][sem][pro]);
alunos[i].notas[ano][sem][pro] = nova;
printf(""\tNota nova %.2f: \n", alunos[i].notas[ano][sem][pro]);,,,,,
break;,,,,,,
,,,,,,
" default: printf(""\tNao eh opcao!""); ",,,,,,
break;}//switch2,,,,,,
}//case1 ,,,,,,
break;,,,,,,
,,,,,,
/*Por nome*/ ,,,,,,
case 2:,,,,,,
{,,,,,,
" printf(""\tNome:\n\t"");",,,,,,
fflush(stdin);,,,,,,
gets(nome);,,,,,,
fflush(stdin);,,,,,,
for (i=0;i<5;i++){,,,,,,
if( strcmp(nome, alunos[i].nome)==0){,,,,,
" printf (""\n\tNome = %s, alunos[i].nome);
printf (""\n\tIdade = %i", alunos[i].idade);,,,,,
x = 1;,,,,,,
break;,,,,,,
},,,,,,
,,,,,,
},,,,,,
" if ( x == 0) {printf (""Aluno nao encontrado!""); _sleep (2500);return ;} ",,,,,,
,,,,,,
" printf(""\n\n\tO que deseja modificar?\n"");",,,,,,
,,,,,,
" printf(""\t1- Nome\n"");",,,,,,
" printf(""\t2- Idade\n"");",,,,,,
" printf(""\t3- Notas\n\t"");",,,,,,
,,,,,,
" scanf(""%i, &opc2);
switch(opc2){
case 1:
printf(""\n\tNovo nome:\n\t"");
scanf (""%s", &nome);,,,,,
strcpy (alunos[i].nome,nome);,,,,,
//troca o nome,,,,,,
break;,,,,,,
,,,,,,
case 2:,,,,,,
" printf(""\n\tNova idade:\n\t"");",,,,,,
" scanf (""%i, &idade);
alunos[i].idade= idade;
//troca idade
break;
case 3:
printf (""\n\tQual Ano ?"");
scanf (""%i", &ano);,,,,,
" printf (""\n\tQual Semestre ?"");",,,,,,
" scanf (""%i, &sem);
printf (""\n\tQual Prova ?"");
scanf (""%i", &pro);,,,,,
" printf (""\n\tDigite a nova nota:"");",,,,,,
" scanf (""%f, &nova);
ano=ano-1;sem=sem-1;pro=pro-1;
printf(""\tNota antiga %.2f: \n", alunos[i].notas[ano][sem][pro]);,,,,,
alunos[i].notas[ano][sem][pro] = nova;,,,,,,
" printf(""\tNota nova %.2f: \n, alunos[i].notas[ano][sem][pro]);
break;
default: printf(""\tNao eh opcao!"");
break;}//switch2
}//case2
break;
}//switch1
}
/*******************************************************************************************/
/*Visualizar Aluno*/
void visualizar( ){
int i, opc,opc2,x=1,temp2,temp4,marc=0,y,t=0,den=0;
float total,temp3,temp5;
char nome[40],temp[40];
w=0;
for(i=0;i<5;i++) {if( alunos[i].idade != 0) {w++;}}
printf(""\n\tAlunos cadastrados : %i\n\n", w);,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
,,,,,,
" printf(""\t1- Aluno Especifico\n"");",,,,,,
" printf(""\t2- Medias e Estatisticas\n"");",,,,,,
" printf(""\t3- Alunos por Ordem Alfabetica\n"");",,,,,,
" printf(""\t4- Alunos por ordem crescente de medias\n\t"");",,,,,,
,,,,,,
" scanf(""%i, &opc);
switch (opc) {
case 1:
printf(""\tDigite o Nome do Aluno que deseja visualizar:\n\t"");
fflush(stdin);
gets(nome);
fflush(stdin);
for (i=0;i<6; i++){
if( strcmp(nome, alunos[i].nome)==0){
marc=1;
printf (""\n\tNome = %s", alunos[i].nome);,,,,,
" printf (""\n\tIdade = %i, alunos[i].idade);
printf (""\n\tMatricula = %i", alunos[i].matricula);,,,,,
break;}},,,,,,
if( marc ==0) {,,,,,,
" printf (""\tAluno nao encontrado!"");",,,,,,
} ,,,,,,
//mostra dados Aluno,,,,,,
break;,,,,,,
,,,,,,
case 2: ,,,,,,
" printf(""\t1-Media total de cada prova\n"");",,,,,,
" printf(""\t2-Media total de cada aluno\n"");",,,,,,
" printf(""\t3-Media total de cada semestre\n"");",,,,,,
" printf(""\t4-Media total de cada ano\n"");",,,,,,
" printf(""\t5-Alunos que rodaram\n"");",,,,,,
" printf(""\t6-Alunos que pegaram exame\n"");",,,,,,
" printf(""\t7-Alunos que passaram\n"");",,,,,,
" printf(""\t8-Voltar\n\t"");",,,,,,
,,,,,,
" scanf(""%i, &opc2);
switch(opc2){
case 1:
printf(""\tMedia das provas\n"");
total=0;
t=0;
for(i=0;i<5;i++){
for(h=0;h<3;h++){
for(j=0;j<2;j++){if(alunos[i].idade!=0){
total=alunos[i].notas[h][j][0]+total;
if(alunos[i].notas[h][j][0]!=0){ t++; }
}}//for
}}
total=total/t;
if( t == 0){ total = 0;}
printf(""\tMedia da prova 1: %.2f", total);,,,,,
,,,,,,
total=0;,,,,,,
t=0;,,,,,,
for(i=0;i<5;i++){,,,,,,
for(h=0;h<3;h++){,,,,,,
for(j=0;j<2;j++){if(alunos[i].idade!=0){,,,,,,
total=alunos[i].notas[h][j][1]+total;,,,,,,
if(alunos[i].notas[h][j][1]!=0){ t++; },,,,,,
}}//for,,,,,,
}//for,,,,,,
}//for,,,,,,
total=total/t;,,,,,,
if( t == 0){ total = 0;},,,,,,
" printf(""\n\tMedia da prova 2: %.2f, total);
break;
case 2:
printf(""\tMedia dos alunos\n"");
for(i=0;i<(5);i++){
total=0;t=0;
for(h=0;h<3;h++){
for(j=0;j<2;j++){
for(k=0;k<2;k++){
if(alunos[i].idade!=0 ){
total=alunos[i].notas[h][j][k]+total;
if(alunos[i].notas[h][j][k]!=0){ t++; } }}
}
}
total=total/t;
if( t == 0){ total = 0;}
if(alunos[i].idade!=0){ printf(""\tMedia do aluno %s: %.2f\n\n", alunos[i].nome,total);} },,,,
break;,,,,,,
,,,,,,
case 3: ,,,,,,
,,,,,,
,,,,,,
" printf(""\tMedia dos semestres\n"");",,,,,,
,,,,,,
for(h=0;h<3;h++){,,,,,,
for(j=0;j<2;j++){,,,,,,
total=0;,,,,,,
for(i=0;i<(5);i++){,,,,,,
for(k=0;k<2;k++){if(alunos[i].idade!=0){,,,,,,
total=alunos[i].notas[h][j][k]+total;}}//for,,,,,,
}//for,,,,,,
,,,,,,
total=total/(w*k);,,,,,,
" printf(""\n\tMedia do semestre %i: %.2f, x,total); x++;}}
break;
case 4:
printf(""\tMedia dos anos\n"");
for(h=0;h<3;h++){total=0;
for(i=0;i<(5);i++){
for(j=0;j<2;j++){
for(k=0;k<2;k++){if(alunos[i].idade!=0){
total=alunos[i].notas[h][j][k]+total;}}//for
}//for
}//for
total = total/(w*j*k);
printf(""\n\tMedia do Ano %i: %.2f", h+1,total);},,,,
break;,,,,,,
,,,,,,
case 5:,,,,,,
,,,,,,
" printf(""\n\tAlunos Rodados:\n"");",,,,,,
,,,,,,
for(i=0;i<(5);i++){,,,,,,
,,,,,,
total=0;t=0;for(h=0;h<3;h++){,,,,,,
for(j=0;j<2;j++){,,,,,,
for(k=0;k<2;k++){if(alunos[i].idade!=0){total=alunos[i].notas[h][j][k]+total;,,,,,,
if(alunos[i].notas[h][j][k]!=0){ t++; }}}}},,,,,,
total=total/t;,,,,,,
if( t == 0){ total = 0;},,,,,,
,,,,,,
" if (total < 40){ if(alunos[i].idade!=0){printf(""\n\t#%s\n\tFoi reprovado com m dia: %.2f\n, alunos[i].nome, total);}}
}break;
case 6:
printf(""\n\tAlunos Que pegaram Exame:\n"");
for(i=0;i<(5);i++){
total=0;t=0;for(h=0;h<3;h++){
for(j=0;j<2;j++){
for(k=0;k<2;k++){if(alunos[i].idade!=0){total=alunos[i].notas[h][j][k]+total;
if(alunos[i].notas[h][j][k]!=0){ t++; }}}}}
total=total/t;
if( t == 0){ total = 0;}
if ((total >= 40) && (total < 70)){if(alunos[i].idade!=0){ printf(""\n\t#%s\n\tMedia: %.2f\n\tNota que precisa no exame: %.2f\n", alunos[i].nome, total, (100-total));}},,,
}break;,,,,,,
,,,,,,
case 7:,,,,,,
,,,,,,
" printf(""\n\tAlunos Passados:\n"");",,,,,,
,,,,,,
for(i=0;i<(5);i++){,,,,,,
,,,,,,
total=0;t=0;for(h=0;h<3;h++){,,,,,,
for(j=0;j<2;j++){,,,,,,
for(k=0;k<2;k++){if(alunos[i].idade!=0){total=alunos[i].notas[h][j][k]+total;,,,,,,
if(alunos[i].notas[h][j][k]!=0){ t++; }}}}},,,,,,
total=total/t;,,,,,,
if( t == 0){ total = 0;},,,,,,
,,,,,,
" if (total >= 70){ if(alunos[i].idade!=0){printf(""\n\t#%s\n\tPassou com media: %.2f\n, alunos[i].nome, total);}}
}break;
case 8 : return;
default: printf (""\tNao eh opcao\n"");break;}break;
case 3:
for (i=0; i<(5); i++){ /* Media */
total =0;t=0;
for (h=0; h < 3; h++){
for (j=0; j < 2; j++){
for (k=0; k < 2; k++){
total = alunos[i].notas[h][j][k]+total;
if(alunos[i].notas[h][j][k]!=0){ t++; }
} } }
if(t==0){ alunos[i].media = NULL;}
else alunos[i].media = total/t;
}
printf(""\n\tAlunos por ordem alfabetica:\n"");
for (x=0; x<(4); x++){
for (n=0; n<(4); n++){
y=strcmp(alunos[n].nome, alunos[n+1].nome);
if(y>0)
{
strcpy(temp, alunos[n+1].nome);
strcpy(alunos[n+1].nome, alunos[n].nome);
strcpy(alunos[n].nome, temp);
temp2 = alunos[n+1].matricula;
alunos[n+1].matricula = alunos[n].matricula;
alunos[n].matricula = temp2;
temp3 = alunos[n+1].media;
alunos[n+1].media = alunos[n].media;
alunos[n].media = temp3;
temp4 = alunos[n+1].idade;
alunos[n+1].idade = alunos[n].idade;
alunos[n].idade = temp4;
for (h=0; h < 3; h++){
for (j=0; j < 2; j++){
for (k=0; k < 2; k++){
temp5 = alunos[n+1].notas[h][j][k];
alunos[n+1].notas[h][j][k] = alunos[n].notas[h][j][k];
alunos[n].notas[h][j][k] = temp5;
} } } //fors
} //if
} } //firsts fors
for (i=0; i<(5); i++){ if(alunos[i].idade!=0){
printf(""\n\t>Nome: %s\n\tMatricula: %i\n\tIdade: %i\n\tMedia: %.2f\n ", alunos[i].nome,alunos[i].matricula,alunos[i].idade,alunos[i].media);}} ,,
,,,,,,
break;,,,,,,
,,,,,,
,,,,,,
,,,,,,
case 4: for (i=0; i<(5); i++){ /* Media */,,,,,,
total =0;t=0;,,,,,,
for (h=0; h < 3; h++){,,,,,,
for (j=0; j < 2; j++){,,,,,,
for (k=0; k < 2; k++){,,,,,,
total = alunos[i].notas[h][j][k]+total;,,,,,,
if(alunos[i].notas[h][j][k]!=0){ t++; },,,,,,
} } } ,,,,,,
,,,,,,
if(t==0){ alunos[i].media = NULL;},,,,,,
else alunos[i].media = total/t;,,,,,,
} ,,,,,,
,,,,,,
,,,,,,
"printf(""\n\tAlunos por ordem de media:\n"");",,,,,,
,,,,,,
for (x=0; x<(4); x++){,,,,,,
for (n=0; n<(4); n++){,,,,,,
if(alunos[n].media > alunos[n+1].media){ ,,,,,,
strcpy(temp, alunos[n+1].nome);,,,,,
strcpy(alunos[n+1].nome, alunos[n].nome);,,,,,
strcpy(alunos[n].nome, temp);,,,,,
,,,,,,
temp2 = alunos[n+1].matricula;,,,,,,
alunos[n+1].matricula = alunos[n].matricula;,,,,,,
alunos[n].matricula = temp2;,,,,,,
,,,,,,
temp3 = alunos[n+1].media;,,,,,,
alunos[n+1].media = alunos[n].media;,,,,,,
alunos[n].media = temp3;,,,,,,
,,,,,,
temp4 = alunos[n+1].idade;,,,,,,
alunos[n+1].idade = alunos[n].idade;,,,,,,
alunos[n].idade = temp4;,,,,,,
,,,,,,
for (h=0; h < 3; h++){,,,,,,
for (j=0; j < 2; j++){,,,,,,
for (k=0; k < 2; k++){,,,,,,
temp5 = alunos[n+1].notas[h][j][k];,,,,,,
alunos[n+1].notas[h][j][k] = alunos[n].notas[h][j][k];,,,,,,
alunos[n].notas[h][j][k] = temp5;,,,,,,
} } } ,,,,,,
} ,,,,,,
} } ,,,,,,
for (i=0; i<(5); i++){ if(alunos[i].idade!=0){,,,,,,
,,,,,,
"printf(""\n\t>Nome: %s\n\tMatricula: %i\n\tIdade: %i\n\tMedia: %.2f\n , alunos[i].nome,alunos[i].matricula,alunos[i].idade,alunos[i].media);}}
break;
default: break;}
getche() ;
}
/*******************************************************************************************/
/*Menu*/
void menu ()
{
int op;
printf (""\t********************************\n"");
printf (""\t* MENU *\n"");
printf (""\t********************************\n\n\n\n"");
printf (""\t Escolha uma opcao: \n\n "");
printf (""\t 1 - INSERIR ALUNO \n"");
printf (""\t 2 - EXCLUIR ALUNO \n "");
printf (""\t 3 - MODIFICAR ALUNO \n "");
printf (""\t 4 - VISUALIZAR \n "");
printf (""\t 5 - SAIR \n "");
printf (""\t \n\t "");
scanf (""%i", &op); ,,,,,
,,,,,,
switch (op){ ,,,,,,
case 1 :,,,,,,
"system (""cls"");",,,,,,
InserirAluno ();,,,,,,
"system (""cls"");",,,,,,
menu();,,,,,,
case 2 : ,,,,,,
"system (""cls"");",,,,,,
ExcluirAluno ();,,,,,,
"system (""cls"");",,,,,,
menu ();,,,,,,
case 3 : ,,,,,,
"system (""cls""); ",,,,,,
ModificarAluno ();,,,,,,
"system (""cls""); ",,,,,,
menu ();,,,,,,
case 4:,,,,,,
"system (""cls"");",,,,,,
visualizar();,,,,,,
"system (""cls"");",,,,,,
menu ();,,,,,,
case 5:,,,,,,
exit (1);,,,,,,
}//escolha ,,,,,,
} ,,,,,,