Mindtap Computing, 1 Term (6 Months) Printed Access Card For Malik's C++ Programming: From Problem Analysis To Program Design, 8th (mindtap Course List)
8th Edition
ISBN: 9781337274739
Author: Malik, D. S.
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 8, Problem 1PE
Program Plan Intro
Creation and use of one dimensional array
The following C++ program defines an array and assigns value to its elements and displays the contents.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Write a C++ program that declares an array myList of 50 components of type integer. Initialize
the array so that the first 25 components are equal to the square of the index variable and the last
25 components equal to doubles the index variable. The program then calculates the sum and
average of elements. In addition, the program counts elements greater than or equal to average
and elements less than average. Output the array so that 10 elements per line are printed.
Sample input / output:
List Elements:
1 4
9
16
25
36
49
64
81
100
121
144
169
196
225
256
289
324
361
400
441
484
529
576
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
Sum of elements: 6750
Average of elements: 135
Elements greater than or equal to 135 is 13
Elements less than 135 is 37
Write a C++ program that reads 6 real numbers from the user (negative and positivenumbers) into an array, then it does the following: Display all the values of array in reverse order. Find the sum and average of positive numbers of the array and display them. Count negative numbers of the array and display it. Find the minimum value of the array and display it. Find the index of the minimum value of the array and display it.
Java Program - Functions with 2D Arrays
Write a function named displayElements that takes a two-dimensional array, the size of its rows and columns, then prints every element of a two-dimensional array. Separate every row by a new line and every column by a space.
In the main function, write a program that asks for integer input to be assigned on a 3 x 3 array and call the function displayElements to print the contents on the next line.
Input
1. Multiple lines containing integer each line
Output
R1C1: 1
R1C2: 2
R1C3: 3
R2C1: 4
R2C2: 5
R2C3: 6
R3C1: 7
R3C2: 8
R3C3: 9
1 2 3
4 5 6
7 8 9
Chapter 8 Solutions
Mindtap Computing, 1 Term (6 Months) Printed Access Card For Malik's C++ Programming: From Problem Analysis To Program Design, 8th (mindtap Course List)
Ch. 8 - Mark the following statements as true or false. A...Ch. 8 - Consider the following declaration: (1,2) double...Ch. 8 - Identify error(s), if any, in the following array...Ch. 8 - Determine whether the following array declarations...Ch. 8 - Prob. 5SACh. 8 - Write C+ + statement(s) to do the following: (1,...Ch. 8 - Prob. 7SACh. 8 - Prob. 8SACh. 8 - Prob. 9SACh. 8 - Prob. 10SA
Ch. 8 - Prob. 11SACh. 8 - Correct the following code so that it correctly...Ch. 8 - Prob. 13SACh. 8 - Suppose that points is an array of 10 components...Ch. 8 - Determine whether the following array declarations...Ch. 8 - Prob. 17SACh. 8 - Prob. 19SACh. 8 - Prob. 1PECh. 8 - Prob. 2PECh. 8 - Write a C+ + function, lastLargestIndex that takes...Ch. 8 - Write a program that reads a file consisting of...Ch. 8 - Prob. 6PECh. 8 - Write a program that allows the user to enter the...Ch. 8 - Write a program that uses a two-dimensional array...Ch. 8 - Prob. 12PECh. 8 - Write a program to calculate students average test...
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
- Write a c++ program! In this assignment, you need to complete tasks on 2D array of randomly sales figures. Assume that you are the manager of coffee shop chain, and oversee six branches. ID of branches are 1 to 6. You already collected sales data for yesterday from each branch, in three categories: morning, afternoon, and evening. First, you need to create a 2D array (6x3) with random numbers between 300 and 1000 (including 300 and 1000), i.e., from $300 to $1000. Then, find / answer Print the sales data on screen in 6 rows and 3 column format Show highest sales amount Show lowest of sales amount Average of sales amount done by shop #3 Is total of all morning sales from all branches higher than total of all afternoon sales from all branches? (Yes/No)arrow_forwardYou have to write a C++ Program to store temperature of four different cities for a week. It shall ask what is unit of all temperatures in array if unit is Fahrenheit it shall convert it to Celsius and vice versa. It shall then store converted temperatures into new arrays and display them. Program shall also display the hottest and coldest city for that week. It shall count cities having same temperature on a specific day of week. I want answer in simple c++ languagearrow_forwardWrite a C++ program that prompts the user to enter the rows, and columns in each rowtocreate a 2D dynamicarray. Make sure that each row in 2D array should contain different number of columns. Fill the array bytaking the values from the user and display the contents of 2D array. Now store the contents of this 2Darray into a newly created 1D dynamic array in such a way that it stores the data column-wisearrow_forward
- Write a C# program that creates an integer array of size 10 and fills the array with numbers set by the programmer (not entered by the user). Then, the program will create two arrays, one of them contains only the odd values of the original array, and the other contains the even values. Note that the size of the newly created arrays should be equal to the number of elements in the array. For example, if the original array contains three odd values, the size of the array that contains the odd values should be equal to three.arrow_forwardWrite a C++ program that creates a 2D integer array of user-defined row size only. Initially, it has only 1 column, but it asks that does the user want to add a column to the array and then takes integer values to fill up the newly created column. It continues to do so until the user enters N/n to exit the program. For Example: Matrix: 1 2 4 8 Do you want to Add a column: y Enter the values in columns: 7 9 So updated Matrix is: Matrix: 1 2 7 4 8 9arrow_forwardWrite a C++ program that generates 100 random numbers within the range of 0 and 76, and stores them into an array A. The program then must do the following computations: Print each number along with its Fibonacci value Print the numbers that are prime (divisible by 1 and itself only) Reverse the content of the array and print itarrow_forward
- Write a C++ program that declares a one-dimensional array of size 5 and holds integer data type. Allow your program to add the 5 integers and calculate the average of these numbers. You should use a for statement to do the addition and average of your numbers with the array.arrow_forwardWrite a program in c++ language that simulates a magic square using 3 one- dimensional parallel arrays of integer type. Each one of the arrays corresponds to a row of the magic square. The program ask the user to enter the values of the magic square row by row and informs the user if the grid a magic square or not. The Lo Shu Magic Square is a grid with 3 rows and 3 columns. It has the following properties: - the grid contains the numbers 1-9 exactly - the sum of each row, each column and each diagonal all add up to the same number. Input for this project - values of the grid(row by row) Output for this project - whether or not the grid is magic square Global constants - const int ROWS = 3; - const int COLS = 3; -const int MIN = 1; -const int MAX = 9; Use following functions: - void fillArray(int arrayRow1[], int arrayRow2[], int arrayRow3[], int size): accepts 3 int arrays and as a size as arguments and fill the arrays out with values entered by the user. - void showArray(int…arrow_forwardUse C++arrow_forward
- Write a C++ program that asks the user to enter two integer arrays of size (6), then check the following cases: Print “Equal” if the last element of the first array is equal to the first element of the second array. Exchange between the third elements of the two arrays if the elements are not equal.arrow_forwardLanguage C++arrow_forwardGiven an array of integers, write a C++ code snippet ( a code snippet is a self-contained piece of source code that performs a specific task typically used for illustrative purposes such as the examples in the videos) that : returns the smallest element in the array. returns the sum of all the elements in the array. swaps the first and the last element in the array.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education