more calculator help...
Thanks for everyone who helped me get past the last error...wasn't even paying attention to that.
When I run the program now it says "int2 being used without being defined"
Who is it not defined? What am I doing wrong with this function? :(
#include
#include
#include
#include
using namespace std;
main()
{
int int1;
int int2;
int answer;
char choice;
void Addition( int, int );
cout << "This program will add, subtract, multiply, and divide two integers." << endl;
cout << endl;
cout << " +++++++ ------- xxxxxxx /////// +++++++ ------- xxxxxxx /////// " << endl;
cout << endl << endl;
cout << "Let's begin!" << endl;
cout << "****************************" << endl;
cout << "*Enter A for addition *" << endl;
cout << "*Enter S for subtraction *" << endl;
cout << "*Enter M for multiplication*" << endl;
cout << "*Enter D for division *" << endl;
cout << "*Enter Q to quit *" << endl;
cout << "****************************" << endl;
cout << endl << endl << endl;
cout << "What is your choice? : ";
cin >> choice;
if(choice == 'A' || choice == 'a')
{
Addition(int1, int2);
}
return 0;
}
void Addition( int one, int two )
// ***************Add integers function******************//
{
cout << "Please enter the first integer :" << endl;
cin >> one;
cout << "Please enter the second integer :" << endl;
cin >> two;
int answer;
answer = one + two;
cout << "The answer is: " << answer << endl;
}
When I run the program now it says "int2 being used without being defined"
Who is it not defined? What am I doing wrong with this function? :(
#include
#include
#include
#include
using namespace std;
main()
{
int int1;
int int2;
int answer;
char choice;
void Addition( int, int );
cout << "This program will add, subtract, multiply, and divide two integers." << endl;
cout << endl;
cout << " +++++++ ------- xxxxxxx /////// +++++++ ------- xxxxxxx /////// " << endl;
cout << endl << endl;
cout << "Let's begin!" << endl;
cout << "****************************" << endl;
cout << "*Enter A for addition *" << endl;
cout << "*Enter S for subtraction *" << endl;
cout << "*Enter M for multiplication*" << endl;
cout << "*Enter D for division *" << endl;
cout << "*Enter Q to quit *" << endl;
cout << "****************************" << endl;
cout << endl << endl << endl;
cout << "What is your choice? : ";
cin >> choice;
if(choice == 'A' || choice == 'a')
{
Addition(int1, int2);
}
return 0;
}
void Addition( int one, int two )
// ***************Add integers function******************//
{
cout << "Please enter the first integer :" << endl;
cin >> one;
cout << "Please enter the second integer :" << endl;
cin >> two;
int answer;
answer = one + two;
cout << "The answer is: " << answer << endl;
}
