need help
Nov 30, 2012 at 6:01am UTC
hi
i want to make a simple calculater on c++ can any one help me
i'm using visual c++ 2010 express
Nov 30, 2012 at 6:04am UTC
Of course we can help you. Post what you have so far, let us know what you are struggling with, and we'll be happy to offer suggestions to help you complete your project.
Nov 30, 2012 at 6:08am UTC
i have started to learn c++
and i can make a mathematic operations but i want to make a calculater to learn and make the user make another operations(don't close the program)
that's my Email :plymaker100@yahoo.com
Nov 30, 2012 at 6:12am UTC
This isn't mine, I found this source code in about 30 seconds using google:
http://www.cpp-home.com/forum/viewtopic.php?f=4&t=16349. But it shows you one example of a simple calculator:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
while (true ) { //add here
signed long int num1, num2;
signed long int ans;
cout<<" SIMPLE CALCULATOR! " << endl;
cout<< endl;
cout<<"1. Addition " << endl;
cout<<"2. Subtraction " << endl;
cout<<"3. Multiplication " << endl;
cout<<"4. Division " << endl;
cout<<"5. Exit Program " << endl;
cout<< endl;
cout<<"Please chose a number<1-5>: " ;
cin >> ans;
if (ans == 1)
{
cout<< endl;
cout<<"(Simple Addition) " << endl;
cout<<"Please enter first number: " ;
cin >> num1;
cout<<"Please enter second number: " ;
cin >> num2;
cout << endl;
cout <<"The answer is: " << num1 + num2 << endl;
}
if (ans == 2)
{
cout<< endl;
cout<<"(Simple Subtraction) " << endl;
cout<<"Please enter first number: " ;
cin >> num1;
cout<<"Please enter second number: " ;
cin >> num2;
cout << endl;
cout <<"The answer is: " << num1 - num2 << endl;
}
if (ans == 3)
{
cout<< endl;
cout<<"(Simple Multiplication) " << endl;
cout<<"Please enter first number: " ;
cin >> num1;
cout<<"Please enter second number: " ;
cin >> num2;
cout << endl;
cout <<"The answer is: " << num1 * num2 << endl;
}
if (ans == 4)
{
cout<< endl;
cout<<"(Simple Division) " << endl;
cout<<"Please enter first number: " ;
cin >> num1;
cout<<"Please enter second number: " ;
cin >> num2;
cout << endl;
cout <<"The answer is: " << num1 / num2 << endl;
}
if (ans == 5)
{
cout << endl;
cout << endl;
cout<< "Thank You! " ;
exit (1);
}
} //end here
system("pause" );
return 0;
}
Nov 30, 2012 at 7:18am UTC
of course there is always the famous stroustrop calculator
Topic archived. No new replies allowed.