QL RUBRIC - Representation 17. Struct Point { int x; int y; }; Point points[10][
ID: 3729527 • Letter: Q
Question
QL RUBRIC - Representation 17. Struct Point { int x; int y; }; Point points[10][10]; How do you access the x member at the 5th column and 6th row? What assumptions did you make? (Solution: points[6][5].x worth 4 QL RUBRIC - Representation, 18. You need to code a function with the following prototype: int findMaximum(int arr[MAX]); Write a function to satisfy the above prototype. State any assumptions you may have made. 19. QL RUBRIC - Representation, Interpretation, Application and Analysis Suppose that you have the following declarations: int times [30] [7]; int speed [15] [7]; int trees [100] [7]; int students [50] [7]; Write the definition of the function print that can be used to output the contents of these arrays. Your function should take only one 2 dim array to achieve this task and be a void function. Write the C++ statements that calls the function print to output the contents of the arrays times, speed, trees, and students.Explanation / Answer
17)
6th row and 5th column: points[5][4].x
assumption: points has been allocated in memory
18)
int findMaximum(int arr[MAX]) {
int max = arr[0];
for(int i=1; i<MAX; i++){
if(max < arr[i])
max = arr[i];
}
return max;
}
Assumption: MAX has been defined
19)
void print(int arr[ROW][COL]) {
for(int i=0; i<ROW; i++) {
for(int j=0; j<COL; j++) {
cout<<arr[i][j]<<" ";
}
cout<<endl;
}
}
print(times);
print(speed);
print(trees);
print(students);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.