How this program looks on Windows 7.
This is a simple calculator written in C++. The user is asked for two numbers and the program prints on the screen their sum,product,difference and quotient.
Download the executable file HERE.
Here's the source code :
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout << "Give two numbers: " << endl;
cin >> a >> b;
cout << "a + b = " << a+b << endl;
cout << "a - b = " << a-b << endl;
cout << "a * b = " << a*b << endl;
if (b!=0) { cout << "a / b = " << a/b << endl;}
else {cout << "a / b is not possible because b=0 " << endl;}
cin >> a;
return 0;
}
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου