Working on the improved calculator program
In this new program, we want to add the following features:
- Allow a user to repeatedly input numbers for calculations
- Make another version of the
Add
function, which adds float values - Add some comments to explain what the code blocks do
- Put the
Add
functions into the separate header and source files –Calculator.h
andCalculator.cpp
Follow these steps:
- Create a new project and name it
MyCPP_03
. - Add the
main.cpp
,calculator.cpp
, andcalculator.h
files to the project. Your Solution Explorer window should now have the files under theHeader Files
andSource Files
folders, like so:
Figure 3.16 – The MyCPP_03 Solution Explorer
- Next, type the following code into the
main.cpp
file:#include <iostream>
#include "Calculator.h"
using namespace std;
void main()
{
cout << "My Calculations" << endl;
&...