Array operantions. Define two arrays of integer numbers (A and B) of size 10 eac
ID: 3570369 • Letter: A
Question
Array operantions. Define two arrays of integer numbers (A and B) of size 10 each. Fill the array A with the first 10 values of the column A, and the array B by asking the user to enter each of the 10 elements. The sheet must show three buttons, each one to perform one of the following operations:
A) Calculate A=A+B ( Sum of array A and array B, the result will be stored in array A)
B) Calculate A.B (Scalar product of array A and array B
C) Clear the data from the sheet
Each button determines an operation to execute using the arrays; the program shall execute the correct operation with those arrays and then show results. The following information, define the operations required:
Sum of arrays: Executes A=A+B (A[0]=A[0]+B[0], A[1]=A[1]+B[1],.....)
Scalar Product (A.B): the function that calculates and returns A.B as defined below.
Explanation / Answer
class test{
int A[10], B[10];
int sum(A,B);
int mul(A,B);
int delete(A,B);
}
int sum (A,B){
A=A+B
return A;
}
int mul(A,B){
return A.B;
}
int delete(A,B){
A.delete();
B.delete();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.