c 2b 2b calculator script

Solutions on MaxInterview for c 2b 2b calculator script by the best coders in the world

showing results for - "c 2b 2b calculator script"
Lennard
06 Jan 2018
1#include <iostream>
2
3using namespace std;
4
5int main()
6{
7cout << "Welcome to the Calculator, write :cancel: to cancel the calculator\n";
8 string cancel;
9
10 while(cancel != "cancel")
11 {
12     int number1 = 0;
13     int number2 = 0;
14     string op;
15
16     cout << "please enter your first number!\n";
17
18     cin >> number1;
19
20     cout << "please enter your second number!\n";
21
22     cin >> number2; 
23
24     cout << "please enter a operator!\n";
25     cout << "( *, / , + , - )";
26
27     cin >> op;
28    
29    if(op == "*")
30    {
31        number1 = number1 * number2;
32        cout << number1; 
33        number1 = 0;
34        number2 = 0;
35    }
36
37    if(op == "/")
38    {
39        number1 = number1 / number2;
40        cout << number1;
41        number1 = 0;
42        number2 = 0;
43    }
44
45    if(op == "+")
46    {
47        number1 = number1 + number2; 
48        cout << number1;
49        number1 = 0;
50        number2 = 0;
51    }
52
53    if(op == "-")
54    {
55        number1 = number1 - number2;
56        cout << number1; 
57        number1 = 0; 
58        number2 = 0;
59    }
60    
61    cout << "Write cancel to cancel\n";
62    cout << "write continue to resume with the calculator!\n";
63    
64    cin >> cancel;
65
66 }
67  
68  
69}
70//powered by my coding server: https://discord.gg/GUgnYHJV
Tim
02 Jul 2016
1#include <iostream>
2
3using namespace std;
4
5int main()
6{
7int num1;
8int num2;
9char op;
10  
11  cout << "Enter a number:" << endl;
12  cin >> num1; //takes input
13  
14  cout << "Enter another number:" << endl; //prints some prompt
15  cin >> num2;
16  
17  cout << "Enter a operator:" << endl; //prints some prompt
18  cin >> op;
19  
20  if(op == '+')
21  {
22  cout << "Result = " << num1 + num2 << endl;
23  }else if(op == '-'){
24  cout << "Result = " << num1 - num2 << endl;
25  }else if(op == '*'){
26  cout << "Result = " << num1 * num2 << endl;
27  }else if(op == '/'){
28  cout << "Result = " << num1 / num2 << endl;
29  }
30  
31  
32}
queries leading to this page
how to make calculator in a program using functions in c 2b 2bc 2b 2b code for calculatorhow to make calculator in c 2b 2bc 2b 2b calculator programcpp program of calculatorhow to make simple calculator in c 2b 2bhow to make a simple calculator program in c 2b 2bc 2b 2b calculator to codecalculator program in cpp using classbuild a calculator in c 2b 2bc 2b 2b calculatorbasic calculator c 2b 2bcalculator with c 2b 2bsimple c 2b 2b calculator codecalculator on c 2b 2bhow to make a calculator in c 2b 2b using class how do do a calculator in c 2b 2bc 2b 2b calculator codeprogram to make calculator in c 2b 2b using functioncalculator code in c 2b 2bbuilding a calculator in c 2b 2bhow to build a calculator in c 2b 2bhow to create a calculator in c 2b 2bc 2b 2b calculator using functionsmaking a calculator c 2b 2bbasic calculator cpphow to make a calculator in c 2b 2bsimple cpp calculator codecalculator using c 2b 2bcalculator with cppcalculator program in c 2b 2bmake a simple calculator in c 2b 2bc 2b 2b calculator source codecpp calculatorc 2b 2b calculator program advancecreate a calculator in c 2b 2bmake a calculator in c 2b 2bc 2b 2b program calculatorc 2b 2b basic calculatorc 2b 2b calculator scripthow to make a calculator with c 2b 2bhow to build a calculator using c 2b 2bcalculator c 2b 2bhow to make a calculator in c 2b 2b using functionssimple calculator using c 2b 2bcalculator code c 2b 2bcalculator in c 2b 2bwhich coding standard to use to make a calculator c 2b 2bc 2b 2b create a calculatorhow to make simple calculator c 2b 2bc 2b 2b calculaorcalculator c 2b 2b using functiondevelop a c 2b 2b program to implement simple calculatorhow to program a calculator in c 2b 2bhow to make a calculator using function in c 2b 2bcalculator in c 2b 2b builderc 2b 2b calculator script