Question: in a main program, read the big numbers, read the operator, do the computation outputting the answer and continuing until the user wants to stop.

 in a main program, read the big numbers, read the operator,do the computation outputting the answer and continuing until the user wantsto stop. please write the C++ program for this instruction. thanks inadvance!!! We represent a 'big num' using the following C++ structure structBigNum { int numDigits; int *digits; // array of digits // suggestion:

in a main program, read the big numbers, read the operator, do the computation outputting the answer and continuing until the user wants to stop.

please write the C++ program for this instruction.

thanks in advance!!!

We represent a 'big num' using the following C++ structure struct BigNum { int numDigits; int *digits; // array of digits // suggestion: least significant digit to most significant digit }; You will only be representing non-negative numbers. Do your calculations in base 10 (the default argument) and for bonus marks make it any base up to hexadecimal. Your assignment is to implement the following functions which are in the file BigNum.h // read from standard input std::cin a number big number // (read as a string) // convert each character of the string read into a digit using // the base (defaulted to 10) // store all the digits read into a dynamic array in the // struct BigNum without any leading zeros // // if the string read has invalid digits, // output an error message and ask the user to try again // until a successful number (string) is read // precondition: // 2 = y so that the result will not be negative suggestion: the digits of x and y are stored from least significant to most significant // postcondition: // returned in the allocated BigNum the digits' difference // and number of digits BigNum* subtract (const BigNum* x, const BigNum* y, int base = 10); // x times y returning the product as a pointer to a BigNum // do the multiplication in base 'base' // precondition: suggestion: the digits of x and y are stored from least significant to most significant postcondition: returned in the allocated BigNum the digits' product // and number of digits BigNum* multiply (const BigNum* x, const BigNum* y, int base = 10); // deallocate the memory allocated for the BigNum struct // and deallocate the memory of its digits array // postcondition: // x is the nullptr (x is passed by reference) void deleteBigNum (BigNum* &x); // given a character ch with a base, return its numerical equivalent // precondition: // 2 '0' 10 ->'A' 11 -> 'B' .... char character (int x); 15 -> 'F' // allocate space for the zero constant as a BigNum // and put the one digit 0 in it BigNum* zeroConstant()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!