C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 8, Problem 8.28E
Program Plan Intro

Program plan:

  1. str1,str2,str3,str4 variablesare used for inputs
  2. char *strcpyptr(char *dest, const char *src) function stores string array reference in pointer variables and copy srcto deststring using pointer arithmetic and return the copied string.
  3. char *strcpyarr(char dest[], const char src[]) function stores string array reference in two array variables and copy srcto deststring using array index and return the copied string.
  4. char *strcatarr(char src[], char dest[])) function stores string array reference in pointer variables and perform concatenation using srcanddeststrings using pointer arithmetic and return the resultant string.
  5. char *strcatptr(char *src, const char *dest) function stores string array reference in two array variables and perform concatenation using srcand dest using array index and return the resultant string.

Program description:

The main purpose of the program is to demonstrate the working of built-in string function strcat() and strcpy() by writing the two versions of each function. One version of each uses the pointer arithmetic to copy and concat the strings. Second version of each uses array index to copy and concat the strings.

Blurred answer
Students have asked these similar questions
- in this exercise, please do not include and use string class. The function is using only array notation and manipulation.- string functions such as strlen is not allowed.- it should not have multiple return statements in the same function- there should be no global variable.- the function should not traverse the arrays more than once (e.g. looping through the array once only) A C++ PROGRAM named "changeCase" that takes an array of characters terminating by NULL character (C-string) and a boolean flag of toUpper. If the toUpper flag is true, it will go through the array and convert all lowercase characters to uppercase. Otherwise, it will convert all uppercase to lowercase. For example, if the array is {'H', 'e', 'l', 'l', 'o', '\0'} and the flag is true, then the array will become{'H', 'E', 'L', 'L', 'O', '\0'}. And if the flag is false, the array will become{'h', 'e', 'l', 'l', 'o', '\0'}
dissolve in c ++. Below, write the code of the program that calls the desired functions in the main function and performs the desired operations. a) random (random number range should be set to be in the range of 5-15) 10 an integer with an element produces numbers and transfers them to an array called array A and displays them enter a function that prints. b) then this sequence takes the arithmetic mean of the elements of the sequence A, round the found average value to the nearest large integer and return it to variable A. enter a function that assigns and prints the variable A on the screen. c) Then write a function that finds the factorial of the variable A value and assigns it to factorial A and prints it on the screen
- in this exercise, please do not include and use string class. The function is using only array notation and manipulation.- string functions such as strlen is not allowed.- it should not have multiple return statements in the same function- there should be no global variable.- the function should not traverse the arrays more than once (e.g. looping through the array once only) A C++ PROGRAM named "isTheLastNumberTheMax" that accepts an array of integers and its size. It will return true if the last number in the array is the maximum number in that array and false otherwise. In addition, it also returns another boolean to indicate whether this list contains more than one maximum value.For example, if this is called with the array of {10, 20, 30, 40, 50}, it will return true and falseIf this is called with the array of {50, 10, 20, 30, 40, 50}, it will return true and true. A C++ PROGRAM named "changeCase" that takes an array of characters terminating by NULL character (C-string) and…
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning