Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : main project file.
- #include "stdafx.h"
- #include <iostream>
- #include<conio.h>
- #include <math.h>
- using namespace System;
- using namespace std;
- void Menu(int n)
- {
- if (n == 1)
- {
- int a, b;
- cout << "Ingrese a: ";
- cin >> a;
- cout << "Ingrese b: ";
- cin >> b;
- float tri = b * a / 2;
- cout << "El resultado es " << tri << endl;
- }
- if (n == 2)
- {
- int a, b;
- cout << "Ingrese a: ";
- cin >> a;
- cout << "Ingrese b: ";
- cin >> b;
- float rec = b*a;
- cout << "El resultado es " << rec << endl;
- }
- if (n == 3)
- {
- int a;
- cout << "Ingrese radio: ";
- cin >> a;
- float ci = 3.1415 * a;
- cout << "El resultado es " << ci << endl;
- }
- if (n == 4)
- {
- int a;
- cout << "Ingrese lado: ";
- cin >> a;
- float cua = pow(a, 2);
- cout << "El resultado es " << cua << endl;
- }
- else
- {
- exit;
- }
- }
- int main()
- {
- cout << "1.- Area de un triangulo" << endl;
- cout << "2.- Area de un rectangulo" << endl;
- cout << "3.- Area de un circulo" << endl;
- cout << "4.- Area de un cuadrado" << endl;
- cout << "5.- salir" << endl;
- cout << "¿que opcion desea?" << endl;
- int n;
- cout << "Ingrese opcion: ";
- cin >> n;
- Menu(n);
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement