I'm new to these forums,and really new to C++,but here is what i need to know.I made a simple calculator in C++ and i was wondering what i need to be able to keep useing it without opening the program everytime...
// simple calc
// Chris Wilson
#include <iostream.h>
int main()
{
float first;
float second;
float oper;
float output;
cout << "|--------------------|\n";
cout << "|-----Chris_Calc-----|\n";
cout << "|--------------------|\n";
cout << "|---------by:--------|\n";
cout << "|----Chris_Wilson----|\n";
cout << "|--------------------|\n";
cout << "Would you like to:\n";
cout << "1)add\n";
cout << "2)subtract\n";
cout << "3)multiply\n";
cout << "4)divide\n";
cin >> oper;
if (oper==1)
{
cout << "enter a number to add\n";
cin >> first;
cout << "enter another number to add\n";
cin >> second;
cout << "you get\n";
output = first + second;
cout << output <<endl;
}
if (oper==2)
{
cout << "enter a number to subtract\n";
cin >> first;
cout << "enter another number to subtract\n";
cin >> second;
cout << "you get\n";
output = first - second;
cout << output <<endl;
}
if (oper==3)
{
cout << "enter a number to multiply\n";
cin >> first;
cout << "enter another number to multiply\n";
cin >> second;
cout << "you get\n";
output = first * second;
cout << output <<endl;
}
if (oper==4)
{
cout << "enter a number to divide\n";
cin >> first;
cout << "enter another number to divide\n";
cin >> second;
cout << "you get\n";
output = first / second;
if (first > second)
cout << output <<endl;
}
system("pause");
return 0;
}