Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE HURRY!!! Given an incomplete program below, complete the program by filling in the blanks with an appropriate C++ statement according to the instructions stated

image text in transcribedimage text in transcribedPLEASE HURRY!!!

Given an incomplete program below, complete the program by filling in the blanks with an appropriate C++ statement according to the instructions stated in the comments. This program copies all the elements of a ID array to a 2D array. Then, find the sum of squares of all elements. Note: Please write C ++ statements WITHOUT blank spaces unless it is absolutely needed. Example: int num,a,b; 1 #include 2 #include using namespace std; 4 5 1/a) Write sumsquare function prototype (2 marks) 3 6 ; 7 int main() { /*b) Declare 2D array type integer, 2 columns 3 rows named val (1 mark)*/ 8 9 10 11 12 13 14 15 16 17 18 ; /*c) Declare 1D array type integer named num with size declarator 6 with initial value: 1,2,3,4,5,6 (2 marks)*/ 19 20 int n = 0; 21 22 23 24 25 26 //d) Copy all elements of array num to val (3 marks) for (int i=0; ; i++) //for row for (int j=0; ; j++) //for column { 27 28 29 30 31 32 n++; } { n++; } /*e) Call function sumsquare, pass array val and display the returned value (2 marks)*/ return 0; } 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 1/sumsquare function definition double sumsquare(int A[][2], int x) { double sum = 0, square; //f) Calculate total of square of all elements in array (5 marks) for (int i=0; ; i++) //forrow for (int j=0; ; j++) { //for column square = } 54 55 56 57 return sum; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

Are these written ground rules?

Answered: 1 week ago

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago