3. Write a menu driven program for the following operations on 2-d array of 3*3 elements in c++: a) sort the data row wise b) sum of diagonals c) sum of elements except diagonals d) transpose the matrix e) multiplication of matrix f) additon of matrix g) display perfect numbers of each column h) display prime numbers of each row i) display max digit of each row j) sort the data column wise
Q: 1. Write a C++ program to find the sum and product of all elements of an array of size 10. Take…
A: /*C++ Program to calculate Sum, Product of all elements.*/ #include <iostream>/* header…
Q: 3.5 Write a program that takes a list of students' names and marks and calculates the average marks.…
A: According to the Question below the Solution: Output:
Q: 3.1 Write C statements for the followings. A-1) Declare 1-dimensional array data type of float with…
A: As per our guidelines we are supposed to answer only 3 subparts or 1 question here i am attempting…
Q: 8. Write statements to accomplish each of the following a. Display the value of the seventh element…
A: a) printf("%c", f[6]); here %c is for the character data type and 6 is the 7th index of array f…
Q: Question 2: Write a C program do the following: Creates a 1-D character array. Fills the array with…
A: /******************************************************************************…
Q: Write C++ statements to do the following: a. Declare an array to hold 7 floating values. b. Assign…
A: Declare an array to hold 7 floating values. float [] Arr = new float[7] Assign value 3.3 to the…
Q: Write C++ statements to do the following: i. Declare an empty aray DATA to hold 7 double floating…
A: Given: Required part 5,6,7
Q: 3. Write a C++ program that performs the following: • Declare an array of floats of size 5 •…
A: #include <iostream>using namespace std; int main() { float arr[5]={2,4,6}; int i;…
Q: Create a function that returns the minimum number of removals to make the sum of all elements in an…
A: Given that Create a function that returns the minimum number of removals to make the sum of all…
Q: Q5) Assume you have 2D array Z with (5x5) elements. Write a C++ program to create another array B…
A: C++ program to copy a 5X5 matrix with reverse elements of each row.
Q: 2. You have a 5*5 empty array. Write a C++ program to fill random values[0,100] in the array and…
A: Task : Create empty 5*5 array Fill it with random values Input row and column index Show values at…
Q: Find the error in each of the following program segments. Assume int *zPtr; // zPtr will reference…
A: Error in above code are as follow a) ++zPtr will not work since zPtr is not allocated memory b) It…
Q: Q2) Choose the correct answer: 1. Every program in C++ must have more than one main ( ) function. a.…
A: CHOOSE THE CORRECT ANSWER
Q: Th e table below shows 32-bit values of an array stored in memory.Address Data 24 2…
A: Answer (a): Code is written below: // to sort the data from lowest to highest the code is here…
Q: write a code in C++ to declare and specify an ARRAY by name of “student marks”. keep the length of…
A: An array is a set of values with the same data type. The mean is the summation of the array…
Q: Q4) An (5,10) array with integer elements from 1 to 50. Write a program in C++ to find the number…
A: Subject: C++ Programming An(5,10) array with integer elements from 1 to 50. Write a program in C++…
Q: суре аr values {54, 47, 91, 76, 29, 63, 18, 30, 85}. Write a suitable program in C to calculate and…
A: #include<stdio.h>int main(){ int a[9]={54,47,91,76,29,63,18,30,85}; float sum=0;…
Q: N numbers are entered by the user (N is also given by the user). Store the numbers in an array.…
A: The code implementation in C++ is given in the below steps. The Algorithm: The user is prompted to…
Q: 4)- Create a C++ program that finds the location, from the list of elements in an array. The program…
A: #include<iostream> using namespace std; //function to find location of the element in array…
Q: Step1: Write a C program to do a bubble sort. You must use a bubbleArray() function to perform…
A: E need to provide C code to read integer file , sort them and rewrite sorted data in other file
Q: 8.8 Write C# statements to accomplish each of the following tasks: a. Display the value of the…
A: Objective: We need to write computational statements for the given requirements including arrays.…
Q: Given the following set: {b, f, g, h, a, c} You are required to write a C++ programming code that…
A: "Due to our Bartleby policy, we can solve only first three-part of the question if need rest of the…
Q: Given the following set: {b, f, g, h, a, c} You are required to write a C++ programming code that…
A: Given: Given the following set: {b, f, g, h, a, c} You are required to write a C++ programming code…
Q: 7. Write a program that performs the following operations: a) (i) Define a structure named…
A: PROGRAM CODE: #include<iostream>using namespace std;// define a structure as name…
Q: Q 1: Write a program in C to find the maximum and minimum element in an array.
A: Given: Q 1: Write a program in C to find the maximum and minimum element in an array.
Q: Q#2(a) Find the error in each of the following program segments. Assume int *zPtr; // zPtr will…
A: Note - As per the guidelines we are only allowed to answer 1 question with 3 sub parts at a time.…
Q: Q1. Write a program to read 25 integer number and calculate the sum and the average. Q2. Write C++…
A: Note - As per our guidelines, we can provide solution only for one question. Since you have asked…
Q: In C++ Please Take number n from user and create an array A of random integers of size n. The size…
A: PROGRAM STRUCTURE: Include the required header files. Start the definition of the function to swap…
Q: 4)- Create a C++ program that finds the location, from the list of elements in an array. The program…
A: #include<iostream>using namespace std;int main(){ int n; cout<<"enter the number…
Q: 7. Define a character (char) array of 5 alphabets {'a','b','c','d','e'}, and a character pointer.…
A: Pointer is a variable that is specially designed in c++ programming to store the address of a…
Q: Notice:The median of the array should be the middle member of a sorted array. Write a code and…
A: program to find median of array:
Q: true or false A)To indicate that 100 locations should be reserved for integer array p, the…
A: Please find the answers in the next step.
Q: Write one or more C++ statements that perform the following tasks: a) Define a constant integer…
A: It is asking for the syntax of the C++ to do the task. I am assuming the name is "John Doe" which is…
Q: Write C++ statements to do the following: i. Declare an empty array DATA to hold 7 double floating…
A: As per our company guidelines, we are allowed to solve first three parts of a question. We are going…
Q: Declare and initiate a float type array of A[ ]. then create another float type array B[ ].find the…
A: Note :- As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: 3. Write a complete C program that inputs 10 integer numbers from user in an array, then it finds…
A: Declare array and variables Create for loop to take input from user and calculate sum Create one…
Q: in C Use one-dimensional arrays to solve the following problem. Read in two sets of numbers, each…
A: Actually, array is a collection of elements.
Q: Q/this C program to calculate the multiplication of two matrices with Two dimensions matrices write…
A: ALGORITHM:- 1. Take input for the size of matrix 1. 2. Take input for the elements of matrix 1. 3.…
Q: Multidimensional Array Exercise 4 - 4m a) Declare two arrays named matrixA and matrixB and…
A: NOTE: Answering only the first 3 subparts as per the guidelines. First, we will declare and…
Q: #include using namespace std; #define SIZE 10 void main () int i, number[SIZE], sum; sum = 0; for…
A: #include <iostream>#include <fstream>using namespace std;#define SIZE 10int main(){…
Q: (c) Give the value of the variable answer in each of assignment statement in the C++ code shown in…
A: Given that, the starting address of testArr is 2232. At stating the ptr variable contains starting…
Q: Find the largest value of element in the given array. Write c++ code
A: The code for this program is as follows: #include<iostream>#include<algorithm>using…
Q: Write a program segment that will perform Bubble Sort Method in sorting the elements of Array B in…
A: Sample Response: //C++ program to implement Bubble sort that starts the comparison from last two…
Q: ) For each of the following, write C++ statements that perform the specified task. a) Declare a…
A: Actually, memory is a used to stores the data.
Q: names, four Write a single c++ program code that employs -Uwing: 1- Define a two-dimensional array…
A: Step 1 : Start Step 2 : Define a function getquizMark() which asks the user for the 3 quiz marks and…
Q: 1.2 Complete the C++ function given below: int count13579(int arr[],int n){ //return the count of…
A: To Do: To write the C++ Code to return the numbers whose count is equal to any of the values…
Q: Write C++ statements to define and initialize the following arrays. a. Array heights of 10…
A: C++ statements to define and initialize the following arrays: a. double heights [10] = {5.2, 6.3,…
Q: Declare two dynamic arrays of length 5. Initialize one of them from user input. Make the second one…
A: Note: we are only allowed to solve one question in one post. I am solving the first on here. To get…
Q: Q.3Write a c++ program that asks the user to enter two numbers (from 100 to 999) to create a matrix…
A: Declaring the variables. Get the start and end input values. Store the values in an array from start…
3. Write a menu driven program for the following operations on 2-d array of 3*3 elements in c++: a) sort the data row wise b) sum of diagonals c) sum of elements except diagonals d) transpose the matrix e) multiplication of matrix f) additon of matrix g) display perfect numbers of each column h) display prime numbers of each row i) display max digit of each row j) sort the data column wise
Step by step
Solved in 2 steps with 3 images
- Mark the following statements as true or false. A double type is an example of a simple data type. (1) A one-dimensional array is an example of a structured data type. (1) The size of an array is determined at compile time. (1,6) Given the declaration: int list[10]; the statement: list[5] - list[3] * list[2]; updates the content of the fifth component of the array list. (2) If an array index goes out of bounds, the program always terminates in an error. (3) The only aggregate operations allowable on int arrays are the increment and decrement operations. (5) Arrays can be passed as parameters to a function either by value or by reference. (6) A function can return a value of type array. (6) In C++, some aggregate operations are allowed for strings. (11,12,13) The declaration: char name [16] = "John K. Miller"; declares name to be an array of 15 characters because the string "John K. Miller" has only 14 characters. (11) The declaration: char str = "Sunny Day"; declares str to be a string of an unspecified length. (11) As parameters, two-dimensional arrays are passed either by value or by reference. (15,16)(Statistics) a. Write a C++ program that reads a list of double-precision grades from the keyboard into an array named grade. The grades are to be counted as they’re read, and entry is to be terminated when a negative value has been entered. After all grades have been input, your program should find and display the sum and average of the grades. The grades should then be listed with an asterisk (*) placed in front of each grade that’s below the average. b. Extend the program written for Exercise 1a to display each grade and its letter equivalent, using the following scale: Between90and100=AGreaterthanorequalto80andlessthan90=BGreaterthanorequalto70andlessthan80=CGreaterthanorequalto60andlessthan70=DLessthan60=F(Data processing) A bank’s customer records are to be stored in a file and read into a set of arrays so that a customer’s record can be accessed randomly by account number. Create the file by entering five customer records, with each record consisting of an integer account number (starting with account number 1000), a first name (maximum of 10 characters), a last name (maximum of 15 characters), and a double-precision number for the account balance. After the file is created, write a C++ program that requests a user-input account number and displays the corresponding name and account balance from the file.
- 2) For each of the following, write C++ statements that perform the specified task.a) Declare a built-in array of type unsigned int called values with five elements, andinitialize the elements to the even integers from 2 to 10.b) Declare a pointer vPtr that points to a variable of type unsigned int.c) Write two separate statements that assign the starting address of array values to pointervariable vPtr.d) Use a for statement to print the elements of array values using pointer/offset notation.e) Refer to the fifth element of values using pointer subscript notation.f) Assume that unsigned integers are stored in two bytes and that the starting address of thearray is at location 1002500 in memory.• If vPtr points to the first element of array values, then what address is referenced byvPtr + 3? (manually calculate)• What value is stored at that location?1) A C++ program to add two numbers using pointers. 2) A C++ program to swap two numbers using pointers. 3) A C++ program that creates a two-dimensional integer array (4x3) initialized with user given data. The program should have the following functions: • Print the sum of all values in the array. • Print the average of all the values in the array. • Take row number from user and print the sum of the values in that specified row.(use loop and no if statement) • Take column number from user and print the sum of the values in that specified column.(use loop and no if statement)1) Write the following C programs (Note : The use of flag or bool is not allowed) a.) A C program to get the largest element in an array using function.b.) Write a function double power (double x, int n) that will compute (xn)
- in C 1- Declare and initialize all values to zero an array of integers 10 x 10 named“thor”.2- Write the code (using for loop) to fill the first row of the array with values 12 3 4 5 6 7 8 9 103- Write the code (using for loop) to fill the last column of the array withvalues 10 20 30 40 50 60 70 80 90 1004- Write the necessary code in main to output the values of thor with eachrow on a separate line and the values of each column separated by acomma.3. Write a C# application that asks the user to search for an item in the array. Input an array of 10 elements and the search item. If the item is found in the array, display the location of the item in the array. Otherwise, display appropriate error messages.attempt the following questions.1. Write a C++ program to find the sum and product of all elements of an array of size 10. Take input from the user.2. Write a program in C++ to find the transpose of a 3x3 matrix input by the user, store it in another array and display it.instructions:1. avoid copy-pasting and plagiarism.2. write a self-written code.3. give "comments" with each line in the code.
- In C++ Please Take number n from user and create an array A of random integers of size n. The size of n can be in the order of billion (109). a) Find the position of largest element LP and smallest element SP of the array. b) Swap the position of Largest element and Smallest element in the array calling function SWAP (A, LP, SP) by pointer (not reference). c) Then calculate the cumulative sum of the numbers in the array A and put it in the same array A. Example: Suppose n=5 and the Array A is- A= [5, 2, 3, 10, 9] Then find the position of largest element LP=4 and smallest element SP =2. Swap the position of L and S by calling SWAP (A, LP, SP) function (by reference) and then A become A= [ 5, 10, 3, 2, 9] Then after calculating cumulative sum the array A will become. A= [ 5, 15, 18, 20, 29]Th e table below shows 32-bit values of an array stored in memory.Address Data 24 2 38 4 32 3 36 6 40 1a. For the memory locations in the table above, write C code to sort the data from lowest to highest, placing the lowest value in the smallest memory location shown in the figure. Assume that the data shown represents the C variable called Array, which is an array of type int, and that the first number in the array shown is the first element in the array. Assume that this particular machine is a byte-addressable machine and a word consists of four bytes.b. For the memory locations in the table above, write MIPS code to sort the data from lowest to highest, placing the lowest value in the smallest memory location. Use a minimum number of MIPS instructions. Assume the base address of Array is stored in register $s6.USE C++ (Display matrix of 0s and 1s) Write a function that displays an n-by-n matrix using the following header: void printMatrix(int n) Each element is 0 or 1, which is generated randomly. Write a test program that prompts the user to enter n and displays an n-by-n matrix. Here is a sample run: