-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0013.cpp
More file actions
73 lines (66 loc) · 2.48 KB
/
0013.cpp
File metadata and controls
73 lines (66 loc) · 2.48 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <stdlib.h>
/*====================================
* eXcript.com
* fb.com/eXcript
* ====================================*/
using namespace std;
int main() {
int total = 0;
int menuOpcao1 = 0;
do{
cout << "Seja bem-vindo a Power-Calculator" <<endl;
cout << "========== Menu principal ==========" <<endl;
cout << "\t0 - sair do programa" <<endl;
cout << "\t1 - calculadora" <<endl;
cout << "menu> ";
cin >> menuOpcao1;
cout << "\t\t>> " <<menuOpcao1 <<" <<" <<endl;
if(menuOpcao1 !=0){
int menuInterno = 0;
do{
int valor = 0;
system("CLS");
cout << "\t0 - voltar ao menu principal" <<endl;
cout << "\t1 - somar com" <<endl;
cout << "\t2 - subtrair de" <<endl;
cout << "\t3 - multiplicar com" <<endl;
cout << "\t4 - dividir com" <<endl;
cout << "\t5 - mostrar total" <<endl;
cout << "Total> " <<total <<endl;
cout << "Digite a opcao desejada>"<<endl;
cout << "menu> ";
cin >> menuInterno;
if(menuInterno!=5 && menuInterno!=0) {
cout << "calc> " <<total <<(
(menuInterno == 1) ? " + " :
(menuInterno == 2) ? " - " :
(menuInterno == 3) ? " * " : " / ");
cin >> valor;
}
if(menuInterno!=0){
switch(menuInterno){
case 1:
total += valor;
break;
case 2:
total -= valor;
break;
case 3:
total *= valor;
break;
case 4:
total /= valor;
break;
case 5:
cout <<"\t\t=========================" <<endl;
cout <<"\t\tValor total> " <<total <<" <<" <<endl;
cout <<"\t\t=========================" <<endl;
break;
}
}
}while(menuInterno!=0);
}
}while(menuOpcao1!=0);
return 0;
}