Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication2.cpp : main project file.
- #include "stdafx.h"
- #include <conio.h>
- #include <iostream>
- using namespace std;
- using namespace System;
- void generar(int * A)
- {
- Random x;
- for (int i = 0; i < 5; i++)
- A[i] = x.Next(1, 7);
- }
- void imprimir(int * B)
- {
- for (int j = 0; j < 5;j++)
- cout << B[j]<<' ';
- cout << endl;
- }
- void calculamin(int * C)
- {
- int min = C[0];
- for (int q = 1; q < 5;q++)
- if (C[q] < min) min = C[q];
- cout << "El numero menor es: " << min<<endl;
- }
- void calculamax(int *D)
- {
- int max = D[0];
- for (int b = 1;b < 5;b++)
- if (D[b] > max) max = D[b];
- cout << "El numero mayor es: "<<max<<endl;
- }
- int main()
- {
- int * Anotas = new int[5];
- generar(Anotas);
- imprimir(Anotas);
- calculamin(Anotas);
- calculamax(Anotas);
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment