Write out the declaration statement for an array having nine rows and twelve col
ID: 3841216 • Letter: W
Question
Write out the declaration statement for an array having nine rows and twelve columns. For some program, you need an array having 10 elements numbered 1 through 10. Write out the proper C++ statements that will declare the array and read values into the array having the desired indices. Define a real array that contains the following values: 1.0, 2.5, 5.0, 7.5, 9.5 and 20.0. In addition, which of the array elements has index 3? Write out the proper C++ statement(s) that does the following: Declare a real array with 100 elements. Pass that array into a Boolean function named query.Explanation / Answer
A. int a[9][9] ;
This means there will be 9 rows and 9 columns will be assigned for the array a.
B.
int main()
{
int num[5], sum = 0;
cout << "Enter 5 num: ";
for (int flag = 0; flag < 5; ++flag)
{
cin >> num[i];
sum += num[i];
}
cout << "Sum = " << sum << endl;
return 0;
}
C.
float values[6]={1.0,2.5,5.0,7.5,9.5,20.0}
as in array first index position will be started with 0 so the element in the index 3 will be "7.5"
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.