Question: C++ code Both images below are under the same number (1a and 1b) Please provide code for whole program and function only to both 1a

C++ code

Both images below are under the same number (1a and 1b)

C++ code Both images below are under the same number (1a and

1b) Please provide code for whole program and function only to bothPlease provide code for whole program and function only to both 1a and 1b.

Implement a function void copyWord(char " destination, const char " source, int numChars); that copies characters from the C-string source into the array destination. The number of characters to be copied is stored in the parameter numChars . After copying the characters, your code should add a null terminator to destination, so that it can be used as a C-string. For example, if source contains the C-string "hi there" and numChars is 2, then the first three elements of destination will be 'h', 'i' and 'no'. Notice in the example we only copied 2 characters from source not 3. The third character, '10', is added by your code. RULES: No local variable allowed and no function calls allowed. Here is the driver used to test your code: Write a function with prototype int addDigits(char num[]) that returns the sum of the digits in a C-string num, which contains all digit characters, i.e. '0', '1', '2', '3', '4', '5', '6', '7', '8', or '9'. (If we just added num[0] + num[1] + nums[2] that would give the sum of ASCII values for '4', ' 3 ' and '6' which would be much bigger than 13 !) RULE: No function calls allowed. The main used to test your code looks like this: int main(){ char t[10] cint; cout

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!