-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathmenuswitch
More file actions
35 lines (32 loc) · 797 Bytes
/
Copy pathmenuswitch
File metadata and controls
35 lines (32 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// menu.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include "conio.h"
using namespace std;
void main()
{
int a, b, r, opcion;
cout << "Ingrese a: " ;
cin >> a;
cout << "Ingrese b: " ;
cin >> b;
cout << endl;
cout << "1.- Suma" << endl;
cout << "2.- Resta" << endl;
cout << "3.- Producto" << endl;
cout << "4.- División" << endl;
cout << "0.- Salir" << endl;
cout << "Elige una opción: " ;
cin >> opcion;
switch (opcion) {
case 1: r = a + b; break;
case 2: r = a - b; break;
case 3: r = a * b; break;
case 4: r = a / b; break;
case 0: cout << "Salir";break;
default: cout << "Opcion invalida" << endl;
}
cout << "El resultado es " << r << endl;
getch();
}