-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.cpp
More file actions
48 lines (41 loc) · 739 Bytes
/
calc.cpp
File metadata and controls
48 lines (41 loc) · 739 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
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "stdafx.h"
#include "calc.h"
#include <iostream>
using namespace std;
void menu(int select)
{
cout << "Select an operation: " << endl;
cout << "----------------------" << endl;
cout << "1. Sum" << endl;
cout << "2. Substraction" << endl;
cout << "3. Division " << endl;
cout << "4. Multiplication" << endl;
cout << "----------------------" << endl;
}
void newline()
{
cout << endl;
}
void result(double r)
{
cout << r;
}
double sum(double a, double b)
{
return a + b;
}
double multiplication(double a, double b)
{
return a * b;
}
double substraction(double a, double b)
{
return a - b;
}
double division(double a, double b)
{
if (b != 0)
{
return a / b;
}
}