[
Homework #2: Programming With C++
è For Each Questions Below, Declare a 1D-Array, A[N], and Load it with Random-Numbers:
Q1: Multiply all elements in A[N] by 5, and print the resulting array.
Q2: Make all Odd elements in A[N] Even by adding 1 to each, print the array after this modification.
Q3: Compute/print Average of Odd elements and Average of Even elements in A[N].
Q4: Reverse the order of elements in A[N] into a second Array-B[N], then print Arrays-B[N].
Q5: Reverse the order of elements in A[N] in the same array (i.e. Swap positions), and print it before & after the swap.
Q6: Sort the elements in A[N] in Ascending-Order, and print the array before &after sorting.
Q7: Sort the elements in A[N] in Descending-Order, and print the array before &after sorting.
è For Each Questions Below, Declare a 2D-Array, Matrix-A [N][ N], and Load it with
Random Numbers Between [ k1…kn], and Print it on screen in MATRIX-FORMAT:
Q8: Print the diagonal elements (Left-to-Right), (or Right -to- Left)
Q9: Compute/Print the average of the diagonal elements (Left -to- Right) (or Right-to- Left)
Q10: Calculates/Print the SUM of each ROW in the matrix
Q11: Calculates/Print the SUM of each COLOUMN in the matrix
Q12: Compute/Print the Sum of all elements Above/Over the Diagonal (Left-to-Right) in Matrix-A
Q13: Compute/Print the Sum of all elements Below/Under the Diagonal (Left-to-Right) in Matrix-A
Q14: Find/Print Maximum (or Minimum) element in Matrix-A.
Q15: Find/Print Maximum element in Matrix-A, and count how many times appeared in Matrix-A.
Q16: Read an Input-Value from User, Search Matrix-A for that input-value; if found count its
occurrences, if not found display a “Not Found” message.
Q17: Multiply Matrix-A with a constant K, entered by the user.
Q18: Find/Print the TRANPOSE matrix of Matrix-A
Q19: Write most efficient code (using for-loop) to print diagonal elements of square Matrix-A(N X N).
(You need to think of a shortcut!).
Q20: Add Matrix-A to Matrix-B and print ONLY the resulting matrix (Matrix-C) in matrix format.
Q21: Repeat Q24 by Print [Matrix-A] + [Matrix-B] = [Matrix-C] lined up next to one another in matrix
format. See example below:
1 1 1 2 2 2 3 3 3
1 1 1 + 2 2 2 = 3 3 3
1 1 1 2 2 2 3 3 3
....................................................................................................
وشكرا لكم كتير اذا حليته الي وساعدتوني بفعمها........ :wub: :wub: :wub: :wub: :wub: :wub: :wub: ....
