1// This is for beginners
2
3#include <iostream>
4
5using namespace std;
6
7void greetings() {
8    cout << "welcome to the calculator made in c++ :D\n";
9}
10
11void instructions() {
12    cout << "Here is the operators you can use + - / *\n";
13}
14
15int main()
16{
17    greetings();
18    instructions();
19    int num1, num2;
20    char op;
21    int result;
22    char again = 'Y';
23
24    while (again == 'y' || again == 'Y') {
25
26
27
28        cout << "\nEnter your first digit: ";
29        cin >> num1;
30
31        cout << "\nEnter your operator digit: ";
32        cin >> op;
33
34        cout << "\nEnter your second digit: ";
35        cin >> num2;
36
37        if (op == '+') {
38            result = num1 + num2;
39        }
40        else if (op == '-') {
41            result = num1 - num2;
42        }
43        else if (op == '*') {
44            result = num1 * num2;
45        }
46        else if (op == '/') {
47            result = num1 / num2;
48        }
49        else {
50            cout << "Invalid operator";
51        }
52
53        cout << "= " << result;
54        cout << "\nDo you want to restart the calculator? (Y or N)";
55        cin >> again;
56    }
57
58    system("pause>0");
59
60    return 0;
61}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/GUgnYHJV1#include <iostream>
2using namespace std;
3
4int main()
5{
6	int choice;
7
8	cout << 1 << endl;
9	cout << 2 << endl;
10	cout << 3 << endl;
11	cout << 4 << endl;
12
13	cout << "Choice A Number: ";
14	cin >> choice;
15
16	if (choice >= 1 && choice <= 4)
17	{
18		int a, b;
19
20		cout << "Enter Num One: ";
21		cin >> a;
22		cout << "Enter Num Two: ";
23		cin >> b;
24
25		if (choice == 1)
26			cout << a << "+" << b << "=" << a + b << endl;
27		if (choice == 2)
28			cout << a << "-" << b << "=" << a - b << endl;
29		if (choice == 3)
30			cout << a << "*" << b << "=" << a * b << endl;
31	}
32	else
33	{
34		cout << "Wrong Choice" << endl;
35	}
36}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}