Advertisement
argentinapb

Untitled

Jul 2nd, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. struct data{
  4. int dia,mes,ano;
  5. };
  6.  
  7. struct aluno{
  8. int codigo,dia,mes,ano;
  9. char nome[50];
  10. double notas[5][2],media[5];
  11. };
  12. //Função para consultar dados
  13. void alteracao(){}
  14. void exclusao(){}
  15. void consulta(struct aluno c){
  16.  
  17.  
  18.  
  19. }
  20. //Função para registrar Alunos;
  21. void inclusao(struct aluno c[],struct data var[]){
  22.  
  23.  
  24. int i=0,j,k;
  25.  
  26. printf("Codigo do aluno:\n");
  27. scanf("%d",&c[i].codigo);
  28. getchar();
  29.  
  30. printf("Nome do aluno:\n");
  31. gets(c[i].nome);
  32.  
  33. printf("Data de nascimento:\n");
  34. scanf("%d %d %d",&c[i].dia,c[i].mes,c[i].ano);
  35.  
  36. //for para ler as notas;
  37. for(k=0;k<5;k++){
  38. for(j=0;j<2;j++){
  39.  
  40. Printf("Nota da materia %d e da prova %d:\n",k,j);
  41. scanf("%lf",&c[i].notas[k][j]);
  42.  
  43. }
  44. }
  45. for(k=0;k<5;k++){
  46.  
  47. c[i].media[k]=(c[i].notas[k][0] + c[i].notas[k][1])/2;
  48.  
  49. }
  50.  
  51.  
  52. i++;
  53. }
  54.  
  55.  
  56. int main (){
  57. int x;
  58. struct aluno c[10];
  59. struct data var[10];
  60. printf("1 Inclusao:\n");
  61. printf("2 Consulta:\n");
  62. printf("3 Alteracao:\n");
  63. printf("4 Exclusao de aluno:\n");
  64. printf("0 Sair:\n");
  65. scanf("%d",&x);
  66.  
  67. switch (x){
  68. case 1:
  69. inclusao(c,var);
  70. break;
  71.  
  72. //case 2:
  73. //consulta();
  74. // break;
  75.  
  76. //case 3:
  77. //alteracao();
  78. // break;
  79.  
  80. // case 4:
  81. // exclusao();
  82. // break;
  83.  
  84. case 0:
  85. system ("pause");
  86. break;
  87.  
  88. default:
  89. printf("Valor invalido\n");
  90. }
  91.  
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement