Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please fill in the blanks. No work need to be shown. It's in C++ Given an incomplete program below, complete the program by filling in

Please fill in the blanks. No work need to be shown. It's in C++

image text in transcribed

image text in transcribed

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 2D array to a ID array. Then, double the sum of all the elements. Note: Please write C ++ statements WITHOUT blank spaces unless it is absolutely needed. Example: int num, a,b; 1 #include using namespace std; 2 4 1/a) Write DoubleTotal function prototype (2 marks) 16 7 8 9 int main() { /*b) Declare 2D array type integer, 2 columns 3 rows named Arri with initial value: 1,2,3,4,5,6. Note: Write your answer WITHOUT using {} symbols (2 marks)*/ }; 10 111 112 13 114 115 16 17 18 119 /*c) Declare 10 array type integer named Arr2 with size declarator 6 (1 mark)*/ int n; 20 21 22 23 24 25 26 27 //d) Copy all elements of array Arri to Arr2 (3 marks) for (int i=0; ; i++) //forrow for (int j=; ; j++) //for column int n = 0; 1/d) Copy all elements of array Arri to Arr2 (3 marks) for (int i=; ; i++) //forrow 20 21 22 23 24 25 26 27 28 29 30 31 32 33 for (int j=0; ; j++) // for column { n++; } /*e) Call function DoubleTotal, pass array Arr2 and display the returned value (2 marks)*/ 34 35 36 37 38 39 40 41 42 43 return 0; } /DoubleTotal function definition double DoubleTotal(int A[], int x) { double sum=; 1/f) Calculate sum of all elements (3 marks) for (int j =0; ; j++) 44 45 46 47 48 49 50 51 52 53 54 55 56 57 1/8) Multiply sum by 2 (2 marks) 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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

Who is the target audience (or audiences)?

Answered: 1 week ago

Question

1. Select the job or jobs to be analyzed.

Answered: 1 week ago