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!

Recommended Answers

All 8 Replies

everything not written in Enter Code was pre-written. so I have to write the code in enter your code here area.

I see that, but you didn't answer my question.

But if that's the case, you've done bugger all with regard to "and I promise i'm really not trying to be lazy. my grade relies on this program so please help me guys"

okay so i need to create a new array* = (something here) in the inputBigInt function right?

int* a = new int[a];

how do i change an int array to a char array?

and how do i take in the number in that function?

Read a book and apply yourself to the problem.

Don't just keep posting one-liner's with random guesses of syntax in the hope that we'll say something more concrete.

This is basic stuff, and you haven't even got to the "hard" (for you) part yet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.