Programming Fundamentals LAB 9
Programming Fundamentals LAB 9
Lab Task#8
SAIF UR REHMAN
Q1# Write a C++ program that initializes an array with
5 float numbers and calculates the sum of these
numbers. Display the sum.
Solution:
Output:
Output:
Output:
Output:
Output:
Output:
Q9-Write a function that swaps two integers using
pointers. Demonstrate the function in a main program
by swapping two user-input integers.
Solution:
Output:
10- Write a C++ program that implements a linear
search algorithm to find a specific element in an
array. If the element is found, print its index;
otherwise, print a message indicating it was not
found?
Solution:
Output:
11- Write a C++ function that takes an integer array
and its size as parameters and returns the maximum
value in the array using pointers.
Solution:
Output:
Output: