Now the first thing that we will need to carry out our programs is a development environment where we can program, for that I recommend that you download the Dev C ++ applicationhere which facilitates the editing of the code although you can use other programs such as codeblocks, everything depends on which one you feel most comfortable with. Download and install the Dev C ++ we proceed to open it, if you do not want to download and use any program you can do it from an online c ++ editor here
Once we are in the code editor we start to create our document, if you downloaded the application and do not know how to create a document you can visualize it through the first chapter of this tutorial here.
To begin we put first the structure of our code how we can visualize in the following image
#include < iostream >
using namespace std;
int main () {
return 0; }
We proceed to place the variables to be used:
float suma, a, b, resta, multiplicacion, division;
Then using cout<<" "; we proceed to ask the user the figures that we will need for the operations, it is also used to show or print on the screen the result obtained in the operations.
cin>> ; we use it to store the data that the user is placing.
Now we can do each of the operations of addition, subtraction, multiplication, division as we can see in the following image:
To finish our small simple calculator, we show the results on the screen as well using thecout<<""; but in the following way:
cout<<"The result of your operation is:"<<endl
cout<<"Suma: "<<suma<<endl<<"Resta: "<<resta<<endl<<"Multiplicacion: "<<multiplicacion<<endl<<"Division: "<<division;
We can see that to show the result only it is not necessary to use " " and to make a line break we use
<<endl
Here we visualize the result of our operations.
This has been all, I hope that it has been to your liking, I will be doing more C ++ tutorials explaining them in the simplest way so that we all learn a bit of programming.
follow me on my social networks
This tutorial was made under the Windows 10 operating system, you can do it with the operating system of your choice.
Posted from my blog with SteemPress : https://erick777.timeets.com/2018/08/27/basic-calculator-with-c/