Advertisement
Catdisk

blablabla

Sep 6th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <iostream>
  4.  
  5. using namespace System;
  6. using namespace std;
  7.  
  8. void input(int *a, int *b, int *c)
  9. {
  10.     char *ordMas;
  11.     ordMas = new char;
  12.     *ordMas = 167; // ยบ
  13.    
  14.     cout << "Ingrese los tres numeros:" << endl << "1" << *ordMas << " : ";
  15.     cin >> *a;
  16.     cout << "2" << *ordMas << " : ";
  17.     cin >> *b;
  18.     cout << "3" << *ordMas << " : ";
  19.     cin >> *c;
  20.  
  21.     delete ordMas;
  22. }
  23.  
  24. void calcularMinMax(int a, int b, int c, int *mayor, int *menor)
  25. {
  26.     if ( a > b && a >c)
  27.     {
  28.         *mayor = a;
  29.     }
  30.     else if (b > a && b > c)
  31.     {
  32.         *mayor = b;
  33.     }
  34.     else if (c > a && c > b)
  35.     {
  36.         *mayor = c;
  37.     }
  38.  
  39.     if (a < b && a < c)
  40.     {
  41.         *menor = a;
  42.     }
  43.     else if (b < a && b < c)
  44.     {
  45.         *menor = b;
  46.     }
  47.     else if (c < a && c < b)
  48.     {
  49.         *menor = c;
  50.     }
  51. }
  52.  
  53. void output(int *mayor, int *menor)
  54. {
  55.     cout << "El numero mayor es: " << *mayor << ", con la direccion: " << mayor << endl;
  56.     cout << "El numero menor es: " << *menor << ", con la direccion: " << menor;
  57. }
  58.  
  59. int main()
  60. {
  61.     int *num1, *num2, *num3 , *max, *min;
  62.     num1 = new int;
  63.     num2 = new int;
  64.     num3 = new int;
  65.     max = new int;
  66.     min = new int;
  67.  
  68.     input(num1, num2, num3);
  69.     calcularMinMax(*num1, *num2, *num3, max, min);
  70.     output(max, min);
  71.  
  72.  
  73.  
  74.     delete num1, num2, num3, min, max;
  75.     _getch();
  76.     return 0;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement