Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace System;
- using namespace std;
- void Alumnos(int *&n) {
- do {
- cout << "Ingrese el numero de alumnos: ";
- cin >> *n;
- } while (*n < 1);
- cout << endl;
- }
- void Notas(int *n, int *notas) {
- Random x;
- cout << "(esto no estaba en el ejercicio, pero para que corrobores: ";
- for (short i = 1;i <= *n;i++) {
- notas[i] = x.Next(0, 20 + 1);
- cout << notas[i] << " ";
- }
- cout << ")" << endl;
- }
- void Promedio(int *n, int *notas, float *pro) {
- short i; *pro = 0;
- for (i = 1;i <= *n;i++) {
- (*pro) += notas[i];
- }
- (*pro) /= i;
- cout << "El promedio de la notas es " << *pro << endl;
- }
- void Moda(int *n, int *notas, int *mod) {
- cout << "La moda es mas dificil y toma tiempo. " << endl;
- }
- void Mayor(int *n, int *notas, int *max) {
- *max = 0;
- for (short i = 1;i <= *n;i++) {
- if (*max < notas[i]) *max = notas[i];
- }
- cout << "La nota maxima de los alumnos es: " << *max << endl;
- }
- void Menor(int *n, int *notas, int *men) {
- *men = 21;
- for (short i = 1;i <= *n;i++) {
- if (*men > notas[i]) *men = notas[i];
- }
- cout << "La nota minima de los alumnos es: " << *men << endl;
- }
- void main() {
- int *n; n = new int;
- int *notas; notas = new int;
- float *pro; pro = new float;
- int *mod; mod = new int;
- int *max; max = new int;
- int *men; men = new int;
- Alumnos(n);
- Notas(n, notas);
- Promedio(n, notas, pro);
- Moda(n, notas, mod);
- Mayor(n, notas, max);
- Menor(n, notas, men);
- cout << endl;
- system("pause>0");
- delete[] n, notas, pro, mod, max, men;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement