hey guys i'm stuck big time, i need some major help.
// *************************************************************
// This program adds large integers that are stored in arrays.
// The digits are stored in the array in reverse order so that
// addition is easier. The program allows a user to keep doing
// more additions as long as he/she wishes.
//
// *************************************************************
#include <iostream>
#include <cctype>
using namespace std;
typedef int* IntArrayPtr;
void inputBigInt (IntArrayPtr &a, int& sizeA);
// Precondition: The user is ready to enter an integer
// Postcondition: The digits of the integer read in are stored
// in reverse order in the array a and the number of digits is
// stored in sizeA. Array a will have been dynamically allocated
void outputBigInt(IntArrayPtr a, int sizeA);
// Precondition: a is defined
// Postcondition: The integer represented by a has been output.
void add (IntArrayPtr a, int sizeA, IntArrayPtr b, int sizeB,
int& sizeSum);
// Precondition: Parameters a, sizeA, b and sizeB have values.
// Postcondition: The parameter sum contains the sum of the
// integers represented by a and b and sizeSum contains the number of
// digits in the sum. Array sum will have been dynamically allocated.
// ========================
// main function
// ========================
int main()
{
IntArrayPtr a;
IntArrayPtr b;
IntArrayPtr sum;
int sizeA, sizeB, sizeSum;
char goAgain; // loop control
cout << endl;
cout << "Addition of big integers" << endl << endl;
do {
//
// Get two big integers
//
inputBigInt(a, sizeA);
inputBigInt (b, sizeB);
//
// Find the sum and print the result
//
add (a, sizeA, b, sizeB, sum, sizeSum);
cout << "The sum of ";
outputBigInt(a, sizeA);
cout << " and ";
outputBigInt(b, sizeB);
cout << " is ";
outputBigInt (sum, sizeSum);
cout << endl << endl;
cout << "Add two more? (y or n): ";
//
// Release the memory
//
delete[] a;
delete[] b;
delete[] sum;
cin >> goAgain;
}
while (goAgain == 'y' || goAgain == 'Y');
return 0;
}
// =================================
// Function definitions
// =================================
void outputBigInt (IntArrayPtr a, int sizeA)
{
//
// Print the digits in reverse order
//
for (int i = 0; i < sizeA; i++)
cout << a[sizeA - i - 1];
}
// --------------------------------
// ----- ENTER YOUR CODE HERE -----
// --------------------------------
// Precondition: The user is ready to enter an integer
// Postcondition: The digits of the integer read in are stored
// in reverse order in the array a and the number of digits is
// stored in sizeA. Array a will have been dynamically allocated
void inputBigInt (IntArrayPtr &a, int& sizeA){
cout << "Please input a number that is less than 20 intergers to be" << endl;
<< "added."<< endl;
cin >> [a];
}
// --------------------------------
// --------- END USER CODE --------
// --------------------------------
and I promise i'm really not trying to be lazy. my grade relies on this program so please help me guys. thank you so much. i'll send you guys cookies for REAL!