Sheet 2 (2024 2025)
Sheet 2 (2024 2025)
1
8. Write a C++ program to first allow a user to input three different
integer numbers from K.B. Then, call a function to find and return
the min value. Finally, print the min value on the screen.
10. Write a C++ program to first allow a user to input three different
integer numbers from K.B. Then, call a function called Min() to
find and return the min value and another function called Max()
to find and return the max value. Finally, print the min and the
max values on the screen.
2
Menoufia University Computer Programming
Faculty of Electronic Engineering AC Year: 2024/2025
Computer Science and Engineering جام عة الم نوف ية 2nd Semester
1
8. Write a program to input 10 values into an array A and then
compute the values of another array B such that each element
in B represent 5 times of the corresponding element in A.
Finally, print both the arrays A and B on the screen.
2
Menoufia University Computer Programming
Faculty of Electronic Engineering AC Year: 2024/2025
Computer Science and Engineering جام عة الم نوف ية 2nd Semester
6. Write a function that accepts an integer array and the array’s size as
arguments. The function should create a copy of the array except that
the element values should be reversed in the copy. The function
should return a pointer to the new array. Demonstrate the function in
a complete program to input n values into the array and print the
original and reversed arrays.
1
7. Write a function that accepts an int array and the array’s size as
arguments. The function should create a new array that is twice the
size of the argument array. The function should copy the contents of
the argument array to the new array and initialize the unused
elements of the second array with 0. The function should return a
pointer to the new array. Show the contents of the arrays on the
screen.
8. Write a function that accepts an int array and the array’s size as
arguments. The function should create a new array that is one
element larger than the argument array. The first element of the
new array should be set to 0. Element 0 of the argument array
should be copied to element 1 of the new array, element 1 of the
argument array should be copied to element 2 of the new array, and
so forth. The function should return a pointer to the new array.
Show the contents of the arrays on the screen.
2
Menoufia University Computer Programming
Faculty of Electronic Engineering AC Year: 2024/2025
Computer Science and Engineering جام عة الم نوف ية 2nd Semester