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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started