Xavistian

Untitled

May 16th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. // ConsoleApplication2.cpp : main project file.
  2.  
  3. #include "stdafx.h"
  4. #include <conio.h>
  5. #include <iostream>
  6. using namespace std;
  7. using namespace System;
  8.  
  9. void generar(int * A)
  10. {
  11.     Random x;
  12.     for (int i = 0; i < 5; i++)
  13.         A[i] = x.Next(1, 7);
  14. }
  15. void imprimir(int * B)
  16. {
  17.     for (int j = 0; j < 5;j++)
  18.         cout << B[j]<<' ';
  19.     cout << endl;
  20. }
  21. void calculamin(int * C)
  22. {
  23.     int min = C[0];
  24.     for (int q = 1; q < 5;q++)
  25.         if (C[q] < min) min = C[q];
  26.     cout << "El numero menor es: " << min<<endl;
  27. }
  28. void calculamax(int *D)
  29. {
  30.     int max = D[0];
  31.     for (int b = 1;b < 5;b++)
  32.         if (D[b] > max) max = D[b];
  33.     cout << "El numero mayor es: "<<max<<endl;
  34. }
  35. int main()
  36. {
  37.     int * Anotas = new int[5];
  38.     generar(Anotas);
  39.     imprimir(Anotas);
  40.     calculamin(Anotas);
  41.     calculamax(Anotas);
  42.     _getch();
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment