Advertisement
Mauriciocaradenepe

otro struct ejemplo :v

Jun 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include<iostream>
  2. #define MAX 10
  3. using namespace std;
  4. struct calificaciones{
  5. char *nombres = new char[10];
  6. float nota1;
  7. float nota2;
  8. float promedio;
  9. };
  10. int main() {
  11. char opcion;
  12. short c = 0;
  13. calificaciones *registro = new calificaciones[MAX];
  14. do
  15. {
  16. cout << "Registro de calificaciones "<<endl;
  17. cout << "Ingrese nombre: "; cin >> registro[c].nombres;
  18. cout << "Ingrese nota1: "; cin >> registro[c].nota1;
  19. cout << "Ingrese nota2: "; cin >> registro[c].nota2;
  20. registro[c].promedio = (registro[c].nota1 + registro[c].nota2) / 2;
  21. ++c;
  22. cout << "\n\t Desea Continuar(s/n) ";
  23. cin >> opcion;
  24. } while (toupper(opcion)=='S'||c==MAX);
  25. system("cls");
  26. cout << "\t Reporte de Estudiantes"<<endl;
  27. cout << "\t ======================" << endl;
  28. short c1 = 0;
  29. do
  30. {
  31. cout << registro[c1].nombres << "\t"
  32. << registro[c1].nota1 << "\t"
  33. << registro[c1].nota2 << "\t"
  34. <<"Promedio: "<< registro[c1].promedio<<endl;
  35. c1++;
  36. } while (c1<c);
  37. cin.get();
  38. cin.get();
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement