Advertisement
Guest User

yo

a guest
Apr 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. // ConsoleApplication1.cpp : main project file.
  2.  
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include<conio.h>
  6. #include <math.h>
  7.  
  8. using namespace System;
  9. using namespace std;
  10.  
  11. void Menu(int n)
  12. {
  13. if (n == 1)
  14. {
  15. int a, b;
  16. cout << "Ingrese a: ";
  17. cin >> a;
  18. cout << "Ingrese b: ";
  19. cin >> b;
  20. float tri = b * a / 2;
  21. cout << "El resultado es " << tri << endl;
  22. }
  23. if (n == 2)
  24. {
  25. int a, b;
  26. cout << "Ingrese a: ";
  27. cin >> a;
  28. cout << "Ingrese b: ";
  29. cin >> b;
  30. float rec = b*a;
  31. cout << "El resultado es " << rec << endl;
  32. }
  33. if (n == 3)
  34. {
  35. int a;
  36. cout << "Ingrese radio: ";
  37. cin >> a;
  38. float ci = 3.1415 * a;
  39. cout << "El resultado es " << ci << endl;
  40. }
  41. if (n == 4)
  42. {
  43. int a;
  44. cout << "Ingrese lado: ";
  45. cin >> a;
  46. float cua = pow(a, 2);
  47. cout << "El resultado es " << cua << endl;
  48. }
  49. else
  50. {
  51. exit;
  52. }
  53. }
  54.  
  55. int main()
  56. {
  57. cout << "1.- Area de un triangulo" << endl;
  58. cout << "2.- Area de un rectangulo" << endl;
  59. cout << "3.- Area de un circulo" << endl;
  60. cout << "4.- Area de un cuadrado" << endl;
  61. cout << "5.- salir" << endl;
  62. cout << "¿que opcion desea?" << endl;
  63. int n;
  64. cout << "Ingrese opcion: ";
  65. cin >> n;
  66. Menu(n);
  67. _getch();
  68. return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement