I need help with my big integer calculator program. The program should receive two large integers using vectors and calculate the sum, difference, product, and quotient o the two integers.
The main file is:
#include <iostream> // cout, <<, >>
#include <fstream> // istream, ofstream
#include <string> // string
#include <cassert> // assert ()
#include <vector> // vector<T>
#include "Test5Q20.h" // read(), add(), subtract(), multiply(), divide()
int main()
{
cout << "Enter First Operand: ";
vector<double> numOperand1;
cin >> numOperand1; // place first number in vector num1
cout << "Enter Second Operand: ";
vector<double> numOperand2;
cin >> num2; // place second number in vector num2
add(vector<double> numOperand1, vector<double> numOperand2); // determine the sum of the two operands
cout << "The sum of operand1 and operand2 is: " << sum << "\n";
subtract(vector<double> numOperand1, vector<double> numOperand2); // determine the difference of the two operands
cout << "The difference of operand1 and operand2 is: " << sum << "\n";
multiply(vector<double> numOperand1, vector<double> numOperand2); // determine the sum of the two operands
cout << "The product of operand1 and operand2 is: " << sum << "\n";
divide(vector<double> numOperand1, vector<double> numOperand2); // determine the quotient of the two operands
cout << "The quotient of operand1 and operand2 is: " << sum << "\n";
}
The header file is:
#include <iostream> // istream, ostream
#include <vector> // vector
#include <cmath> // pow
using namespace std;
/*add() finds the sum of operand1 and operand2.
*
* Receive: numOperand1 & numOperand2, a vector<double>
* Precondition: numOperand1 & numOperand2 is not empty
* Return: the sum of the operand1 & operand2
***************************************************************/
double add(vector<double>& numOperand1, vector<double>& numoperand2)
{
if (numOperand1.empty()) || (numOperand2.empty());
{
cerr << "\n***ADD: empty vector received!\n" << endl;
return 0.0;
}
else
return add(numOperand1 + numOperand2);
}
/*subtract() finds the difference of operand1 and operand2.
*
* Receive: numOperand1 & numOperand2, a vector<double>
* Precondition: numOperand1 & numOperand2 is not empty
* Return: the difference of the operand1 & operand2
***************************************************************/
double subtact(vector<double>& numOperand1, vector<double>& numoperand2)
{
if (numOperand1.empty()) || (numOperand2.empty());
{
cerr << "\n***SUBTRACT: empty vector received!\n" << endl;
return 0.0;
}
else
return add(numOperand1 - numOperand2);
}
/*multiply() finds the sum of operand1 and operand2.
*
* Receive: numOperand1 & numOperand2, a vector<double>
* Precondition: numOperand1 & numOperand2 is not empty
* Return: the product of the operand1 & operand2
***************************************************************/
double multiply(vector<double>& numOperand1, vector<double>& numoperand2)
{
if (numOperand1.empty()) || (numOperand2.empty());
{
cerr << "\n***MULTIPLY: empty vector received!\n" << endl;
return 0.0;
}
else
return multiply(numOperand1 * numOperand2);
}
/*divide() finds the sum of operand1 and operand2.
*
* Receive: numOperand1 & numOperand2, a vector<double>
* Precondition: numOperand1 & numOperand2 is not empty
* Return: the quotient of the operand1 & operand2
***************************************************************/
double divide(vector<double>& numOperand1, vector<double>& numoperand2)
{
if (numOperand1.empty()) || (numOperand2.empty());
{
cerr << "\n***DIVIDE: empty vector received!\n" << endl;
return 0.0;
}
else
return quotient(numOperand1 / numOperand2);
}