PDA

View Full Version : Perform basic calculation in C++(+,-,/,*)


Hitterman
17-07-08, 08:15 PM
Here is a simple way to Perform basic calculation in C++.
The calculations will be performed between two values Provided by the user.
# include <iostream.h>
# include <conio.h>
void main()
{
clrscr(); //Used to clear screen
float a,b,c,d,e; //Use float as the results can be in Decomals.
cout<<"Enter the first value"<<endl; //You can change this statement
cin>>a;
cout<<"Enter the second value"<<endl;
cin>>b;
clrscr();
cout<<"Addition of two values:"<<a+b<<endl; //First value + second value
cout<<"Difference of Two values:"<<a-b<<endl; //First value - second value
cout<<"Product of two values:"<<a*b<<endl; //First value * second value
cout<<"Division of two values:"<<a/b<<endl; //First value / second value . You can also perform more calculation by changing the Arithmatic operators.
getch();
}
That's all. Hope this helped you.:cheers

lyoko321
14-08-08, 07:44 AM
Wow my head is spinning lol. I don't really understand this stuff, but I do know some stuff. Still my head spins lol. :leaving:

affe555
08-10-08, 04:04 PM
well this 1 is basically the easyiest stuff to work with :D i dont know much at programming too but this one is quite easy :cool: but what really is a pain in the ass is to learn how to code what you want (for example an aimbot)

Hitterman
08-10-08, 04:38 PM
That's a fact that C++ is one of the most Toughest language but if you know it completely, its like beating the death forever.