Calculators are made to calculate simple to difficult equations or even just the basic math equations. Addition, Subtraction, Multiplication and Division are the four basic mathematical operation and the foundation in creating equations that are used for calculating specific or certain things. Since kindergarten, we are taught how those operations work with numbers. So, I thought of making a program that can be helpful not just in our daily encounter with mathematics but also in teaching our younger ones about the four basic mathematical operation.
This program is used with a float data type identifier. The difference of float (%f) from int (%d) is that int only accepts whole numbers for input even on outputs. While float accepts numbers with decimal points, also with the outputs. It is also a C++ language code. Check out the codes below.
#include <iostream> #include <conio.h> using namespace std; int main() { float num1 = 0.0f; float num2 = 0.0f; cout << "Enter a real number n1: "; cin >> num1; cout << "Enter a real number n2: "; cin >> num2;