Working with a basic calculator program
The MYCPP_02 program should have a main() function and an Add() function. The signature and the tasks defined for these two functions are as follows:
void Main(): This calls theAdd()function to calculate 1 + 2 and 3 + 4 and output the resultsint Add(int a, int b): This adds up the two integer parameter values,aandb, and returns the calculation result
So, let’s create a new C++ project, name it MyCPP_02, and then add a new main.cpp file.
Then, type in the following code for main.cpp:
#include <iostream>int Add(int a, int b)
{
return a + b;
}
void main()
{
std::cout << "My Calculations" << std::endl;
int result = Add(1, 2);
std::cout << "Integer addition: 1 + 2 = "
<< result
...