(Practice) Write a C++
first second
16 18 23 24 52 77
54 91 11 16 19 59
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
C++ for Engineers and Scientists
- (Electrical eng.) a. An engineer has constructed a two-dimensional array of real numbers with three rows and five columns. This array currently contains test voltages of an amplifier. Write a C++ program that interactively inputs 15 array values, and then determines the total number of voltages in these ranges: less than 60, greater than or equal to 60 and less than 70, greater than or equal to 70 and less than 80, greater than or equal to 80 and less than 90, and greater than or equal to 90. b. Entering 15 voltages each time the program written for Exercise 7a runs is cumbersome. What method could be used for initializing the array during the testing phase? c. How might the program you wrote for Exercise 7a be modified to include the case of no voltage being present? That is, what voltage could be used to indicate an invalid voltage, and how would your program have to be modified to exclude counting such a voltage?arrow_forwardQ) Write a program to count the palindromic array elements from the group of 30 array elements where array is allocated memory dynamically (Only Using C++)arrow_forward1) Write a C++ Program to Multiply Two Matrix Using Multi-dimensional Arrays. You can use int or double 2D array and takes it input from user. This program takes two matrices of order r1*c1 and r2*c2 respectively. Then, the program multiplies these two matrices (if possible) and displays it on the screen, please take input from user.arrow_forward
- Consider the following code and answer the questions. ( C programming ) int ary[] = {5, 9, 4, 2, 6, 7, 8, 4}; Q A: What is the starting index of ary Q B: What is the last index of ary Q C: Write statement to print all array values in reverse order of the array. Write your answers below:arrow_forward1-Write a C++ program to delete duplicate elements from array. How to remove duplicateelements from array in C++ programming. After performing delete operation the arrayshould only contain unique integer value. Logic to delete duplicate elements from array.ExampleInputInput array elements: 10, 20, 10, 1, 100, 10, 2, 1, 5, 10OutputAfter removing all duplicate elementsElements of array are: 10, 20, 1, 100, 2, 5arrow_forwardc++ programme(look at images) An organization would like to store in an array up to 100 donations. A donation is a floating-point value. Write a program which reads donations and stores them into an array which is capable of only holding 100 floats. A value of -1 can be used to terminate the input. A sample run would be:Enter donation: 50.00Enter donation: 20.00Enter donation: 95.00Enter donation: -1As a result the array of donations would look like:Given this, using an additional array of 100 float pointers, sort the contents of the donations arrays without actually moving any data in the donations array.To do this, each element of the array of pointers should be pointing to the corresponding element of the donations array.Once this has been done, simply reorder the pointers to point to the elements of the donations array in ascending order. Your pointers array should look like this:Print out the collection of numbers sorted using the pointers arrayarrow_forward
- viii) In this question you have to write a C program to input the elements of an integer array A of size 10 and then replace every even number in the array with any random number in the range [0, 9] and print the array in the output.arrow_forwardQ5) Write a C++ program to split the odd numbers and even numbers of one array into two array: A=[1,2,3,4,5,...20] Aodd=[1,3,5,7,...,19]| Aeven=[2,4,6,8,...,20]arrow_forwardc++ Write a program to swap the contents of two arrays. Each array has five elements. The fist array has values of 0, 2, 4, 6, 8. The second array has values of 1, 3, 5, 7, 9. Display the contents of each array both before and after swapping.arrow_forward
- 1-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_forwardDirection: Design, develop and implement a menu driven program in C for the following Array operations: a. Creating Array of N Integer elements b. Display of Array elements with suitable headings. c. Inserting an element (ELEM) at a given valid position (POS). d. Deleting an element at a given valid position (POS). е. Еxit NOTE: An Array is a collection of similar/same elements. This activity, the Array can be represented as one / single dimensional elements. Menu driven program in C language to perform various array operations are implemented with the help of user defined functions such as: a. create() b. display() c. insert() d. del() е. exit() Algorithm: 1. Start 2. Read N value 3. Read array of N integer elements 4. Print array of N integer elements 5. Insert an element at given valid position in an array. 6. Delete an element at given valid position from an array. 7. Stop Sample Output: --Menu----- 1.Create 2.Display 3. Insert -Menu-- 1.Create 2.Display 3.Insert 4.Delete 5.Exit…arrow_forwardQ2: Write a C++ function (call it index_max) that finds the maximum number in a 1-D array of floats, that is passed to the function, and returns the max number and its index. For example, if you pass [5.1, 6, 8.5, 9, 5.6, 2.7] to the function, you obtain 9 and 3. Write a C++ program and test your function. Take the following note into consideration when writing your program: • The function should prevent changing the elements of the passed array.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr