Calculator Application with Library 2.1.2
A simple library for performing basic arithmetic operations with application
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CalculatorLibrary.Calculator Class Reference

Performs basic arithmetic operations on integers. More...

Public Member Functions

int Add (int a, int b)
 Adds two integers.
 
int Subtract (int a, int b)
 Subtracts one integer from another.
 
int Multiply (int a, int b)
 Multiplies two integers.
 
int Divide (int a, int b)
 Divides one integer by another using integer (truncating) division.
 

Detailed Description

Performs basic arithmetic operations on integers.

This is the sample class the template ships with. When you start your own project, replace it (and CalculatorCli) with your own domain classes — see docs/guide/from-topic-to-project.en.md for the step-by-step walkthrough.

Definition at line 11 of file Calculator.cs.

Member Function Documentation

◆ Add()

int CalculatorLibrary.Calculator.Add ( int a,
int b )

Adds two integers.

Parameters
aThe first addend.
bThe second addend.
Returns
The sum of a and b .

Definition at line 16 of file Calculator.cs.

16 {
17 return a + b;
18 }

◆ Divide()

int CalculatorLibrary.Calculator.Divide ( int a,
int b )

Divides one integer by another using integer (truncating) division.

Parameters
aThe dividend.
bThe divisor.
Returns
The integer quotient of a divided by b .
Exceptions
DivideByZeroExceptionThrown when b is zero.

Definition at line 41 of file Calculator.cs.

41 {
42 if (b == 0) {
43 throw new DivideByZeroException();
44 }
45
46 return a / b;
47 }

◆ Multiply()

int CalculatorLibrary.Calculator.Multiply ( int a,
int b )

Multiplies two integers.

Parameters
aThe first factor.
bThe second factor.
Returns
The product of a and b .

Definition at line 32 of file Calculator.cs.

32 {
33 return a * b;
34 }

◆ Subtract()

int CalculatorLibrary.Calculator.Subtract ( int a,
int b )

Subtracts one integer from another.

Parameters
aThe value to subtract from.
bThe value to subtract.
Returns
The result of a minus b .

Definition at line 24 of file Calculator.cs.

24 {
25 return a - b;
26 }

The documentation for this class was generated from the following file: