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
(a) During the execution of the above code, how many instructions are executed? (b) Assuming a standard unicycle machine (CPI = 1) running at 100 KHz, how long will the above code take to complete?
C programing, not C++ write a function num_digits(n) that returns the number of digits in a nonnegative integer n.
Write a C program that forks two child processes. The parent process will print all prime numbers up to 229, the first child process will print the first 50 Fibonacci numbers.
Write down the c++ program which declares the array of 50 components of type float. Initialize array so that first 25 components are equal to square of the index variable.
Write a program in C to calculate diameter in centimeters of steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.
Create a program to compute the derivative of an arbitrary input function, with arbitrary duration and arbitrary limits
Write a program in c++ that takes 100 number in an array and add them and print the sum
Objective: Create a C++ console application that will model the characteristics of a resistor. Create a multifile project. Create and add to the project an h file containing the resistor-class definition. Create and add to the project a cpp file cont..
Write a c++ program that stores the following numbers in the array named miles: 15,22,16,18,27,23, and 20. have your program copy the data stored in miles to another array.
Define a structure to store roll no, name and marks of a student - using the structure of Q2. a), above write a 'C' program to create a file "student.dat". There must be one record for every student in the file.
Unit 3 Individual Project SSCI210 – 1304B – 01 A typical individual who commits who commits hate crimes whether it is against or aimed at the Gay/lesbian community , the persons of color or the Jewish community, ( I mention these three because they a..
Create a template class, SVector, that implements a constructor
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