C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 10.2, Problem 4E
(
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What is the data type of pointer variables? Suppose that we don‘t know the name of a variable but we do know its address. Can we access the contents of that variable? Explain briefly.
Subject: C++
Please solve and show steps, work, and information related to this problem. Thank you.
The following C++ code performs a set of various arithmetic operations using both pointers and references:
Fill in a memory table that shows the final values for both function a and function b.
Indicate the final values of each parameter, passed in variable(s), and the return value of the function. Provide a separate copy of this memory table for each function.
- 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'}
Chapter 10 Solutions
C++ for Engineers and Scientists
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Fill in the table below to trace the values of the arrays in main at various points.arrow_forward# Author: _________________________#========================================================#========================================================# Program to sum numbers in an# array of 8-bit integers (byte)# and an array of 32-bit integers (.word)# (You MUST use indexed access for the words[] array)# (You may use indexed or pointer access for the byte[] array)# (Feel free to use the MUL instruction to multiply..)# -------------------------- C++ code ------------------# #include <iostream># #include <string># using namespace std;# void main()# {# const int SIZE = 8;# byte[] bytes = { 6, 5, -1, 9, 2, 3, -8, 2, -4, 7 };# int[] words = { 6, 5, 1, 9, 2, 3, 8, 2, 4, 7 };# doSums(bytes, words, SIZE);# cout << endl;# }# void doSums(byte& b, int& w, int n)# {# int sum = 0;# for(int x = 1; x <= n; x++) {# if ( b[x] < 0 )# sum = sum + ( b[x] * w[x-1] );# else# sum = sum + ( b[x] * w[x+1] );# cout << sum << " ";# }//end for# }# OUTPUT: 5 0 18 24 48…arrow_forward3234-Write a C++ program to input elements in array and sort array elements in descending order. How to sort array in descending order in using pointers.Use function to print out the original and sorted arrays, Example Input Input size of array: 10 Input array elements: 20, 2, 10, 6, 52, 31, 0, 45, 79, 40 Output Array sorted in descending order: 79 ,52,45,40,31,20,10,6,2,0arrow_forward
- Write a program in C++ of how to use two-dimensional dynamic arrays. Follow the instruction below; - Declare the function of fill and print - Create main function and include your information details - Declares 'board' to be a pointer to a pointer of type int - Declare the 'rows' and 'columns' as integer variables - Prompt user to enter the number of rows and colums - Get the user input of rows and colums - Create the rows of board - Create the columns of board - Insert elements into board - Print the elements of boardarrow_forwardConsider the following C++ Code - Write a C++ code that outputs the contents of the array to which strPtr Points and deallocates the memory space occupied by the array to which strPtr points. - Can you modify the code to use a different array size for strPtr? How would this affect the output of the program?arrow_forwardIn Assembly 1. Write code that traverses (or goes through) the following array using the ESI register: .dataarrayOfWords 1020h, 3040h, 5060h, 7080h, 9090h 2. Write code that again, traverses the array in Question #1, but this time using a loop. 3. Using the same array in Question #1, access the 3rd element in the array (the one with subscript 2)4. Declare a variable that works as a pointer to BYTEs.arrow_forward
- 44.____Write a code in CPP that performs the sum operation on array of 10 elements. Elements of array should be taken from user at run time. In order to point to the next position of array you need to use pointer arithmetic.?arrow_forwardWrite a C++ function that takes two integer arrays and adds each element of both arrays using pointers not by index and function must check the array size to ensure same number of elements.arrow_forwardI need the answer quickly What is the meaning of the following declaration? int(*p[5])(); a) p is pointer to functionb) p is array of pointer to functionc) p is pointer to such function which return type is the arrayd) p is pointer to array of functionarrow_forward
- 4. What does this function return? Which principle does it illustrate?arrow_forwardby using c++. How can I solve this? Kindly, no class, linked list, and pointers shall be used in this program. Kindly use only SELECTION, ITERATION, INPUT, AND OUTPUT, FUNCTION, ARRAY, AND STRING ONLY.arrow_forward- 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) write 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.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
1.1 Arrays in Data Structure | Declaration, Initialization, Memory representation; Author: Jenny's lectures CS/IT NET&JRF;https://www.youtube.com/watch?v=AT14lCXuMKI;License: Standard YouTube License, CC-BY
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License