Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q 2. A 2 dimensional array of doubles has the same number of rows and columns (a square array). Assume the valuesare already loaded in the array. Write a loop to calculate the sum total of the elements of the diagonal (the elementswith the same row and column subscript values). In the following example 4x4 2-d array, the elements on the diagonalare in boldface type. Use the partial declarations given.12 8 -11 76 3 0 2.97 7 -11 10-3 -7 4 8array< array<double, 4>, 4> mat = { the initial values would go here };double sum = 0.0;// write the codePage 2 of 2 2013-12-09for (int i(0); i < 4; i++)sum += mat[i][i];Q 3. A 2 dimensional array of doubles has the same number of rows and columns (a square array). Assume the valuesare already loaded in the array. Write a loop to calculate the sum total of the elements of the anti-diagonal (theelements whose row and column subscripts add up to the number of rows (or number of columns as they are equal) ?1). In the following example 4x4 2-d array, the elements on the anti-diagonal are in boldface type. Use the partialdeclarations given.12 8 -11 76 3 0 2.97 7 -11 10-3 -7 4 8array< array<double, 4>, 4> mat = { the initial values would go here};double sum = 0.0;// write the codeQ 4. Repeat these questions by writing functions that receive the arrays as constant reference parameters and returnthe appropriate values through the function name (via return statement). The function header could look like:double sumDiag(const array< array<double, 4>, 4> & mat) {// write the code} // end functiondouble sumAntiDiag(const array< array<double, 4>, 4> & mat) {double sum = 0.0;for (int i(0); i < 4; i++)sum += mat[i][3 - i]; // Note: i + (3 - i) = 4 - 1return sum;} // end function
Write down a program in C++ to compute surface area of sphere using a function. As sample run, write down the surface areas of spheres with radii.
Write a program to compute the total volume for a number of cylinders. A cylinder may have different values for height and radius.
Follow these specifications: Use a define statement to create a constant that will hold your student number. You should have separate string variables for your first and last name; name these first_name and last_name.
Write down function that computes leap years. Function prototype is as follows: Write function body which returns true if year is a leap year and false if year is not a leap year.
How do you get this program to get both player input and then display results(As described on bottom) #include const int NUM_YEARS=15;//The number of years const int NAME_SIZE=32;//The max size of the player name string
Maze program. In this assignment you will represent a maze with a binary tree. . The starting point is node N and the ending point is node Z.
Explain what constructors do and when they are executed. Explain the two types of constructors. Provide an example class that includes both types of constructor functions and demonstrate how an object would be instantiated using both types of constru..
As is know, acetone is a polar molecule like water, so isn't it suppose to mix? So my question is: why does the Neverwet spray protect it from water but not from oils and detergents?
Write a program that asks the user to enter the names of three salesmen. The program should thenaccept the sales produced for salesman for each quarter of the year. Display the name, and the totalsales amount, of each salesman.
Determine the mean(average) of the numbers in the array, and output the reslt. Use a subprogram to input the numbers, a function to find the mean.
Create the program in C++ which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and show miles per gallon.
Design a class named TextBook that is child class of Book. Include new data field for grade level of book. Create a displayTextBookInfo () method so that you can accommodate new grade-level field.
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd