Question: I need help modifying my program to prompt the user for a file name, then read BigIntegers from that file and keep a running total.
I need help modifying my program to prompt the user for a file name, then read BigIntegers from that file and keep a running total. I need to have my program output the total to a file so that I can copy and paste the result.
Below is the the bigInt.txt file and my code.
bigInt.txt file
245665467856549678546678 2545466554675487 34245654686546708 25465464 24546354654685675465465469546789546678901046754345464054 425465467565466785409 1233789132678978780 13223978132576976 10567007484507483087000 34056706789078798054
My Code
#include
using namespace std;
int valueOf(char c) { if ((c >= '0') && (c <= '9')) { return c - '0'; } else { return c - 'a' + 10; } }
std::vector
void displayDecimalDigits(vector
std::vector
std::vector
std::vector
std::vector
vector
result = normalize(result, 10); result = trimLeadingZeros(result); return result; }
int main() {
string s1 = "001238042"; std::vector
b1 = trimLeadingZeros(b1); displayDecimalDigits(b1);
b1 = addLeadingZeros(b1, 4); displayDecimalDigits(b1);
b1 = normalize(b1, 10); displayDecimalDigits(b1);
cout << "Welcome to BigInteger Version 1! "; cout << "Please enter a Big Integer: "; cin >> s1; std::vector
cout << " Thank you for playing BigInteger!";
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
