Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For C++, Write overloaded sumAscii functions, one of which takes a single string argument, the second which takes two string arguments. The two functions should

For C++,

Write overloaded sumAscii functions, one of which takes a single string argument, the second which takes two string arguments. The two functions should return the sum of all of the ASCII characters within the string argument(s).

One of the nice things about overloaded functions is that many times one of the functions solves a smaller version of the larger problem. That is exactly the case for this assignment. Since the sumAscii function solves the problem for one string you are required to use it to solve the problem for two strings. What I am getting at here is that you should avoid duplicating the code in each one of these functions. You should simply call one function from within another.

You should always reuse any code that you have already written. If you have written a function that would help you solve this problem you should use it. When I say use it I don't mean take the code out of the function and put it in another. You should use the function as a whole and simply call upon it to solve part of the problem.

What not to do

Using any of the following will drop your grade for this assignment by 70%

global variables

cin in sumAscii function

cout in sumAscii function

goto statements

You will also get marked down for duplicating code and failing to use the smaller function to solve the problem of the larger one.

Here is what your output should look like:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions