Question: C++ Write a function that adds two non-negative integers represented as strings, returning the result as a string. The function must use the following signature:
C++
Write a function that adds two non-negative integers represented as strings, returning the result as a string.
The function must use the following signature:
string add(const string& num1, const string& num2)
The values num1 and num2 can represent arbitrarily long integers, so all the calculations must be done without using integer types (except for calculating each digit.)
There is no need to check for or deal with strings that do not represent non-negative integers.
Restrictions
In your submitted work (any of the functions you write) you should not print out anything to cout or cerr, and you should not use terminal input cin.
You may only include the libraries iostream and string. No other includes are permitted.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
