Each function in your program should have a header comment a
Each function in your program should have a header comment as well. Describe its purpose, the parameters and the return value (if any). Use a format similar to:
// Function name: <function name>
// Purpose: <describe what the function is doing>
// Parameters: <add the name and the description of each of the function parameters>
// Return value: <add the description of the return value, if any>
(1) Write a program in C++ that asks the user to enter an array of size 10 and pass the array to a function named reverse_array that takes as its arguments an array of floating point values and an integer that tells how many floating point values are in the array. The function must reverse the order of the values in the array. The function should not return any value. Do not forget to write the main function as well. Display the original array and the reversed array in the main function.
Solution
#include<iostream>
 #include<stdlib.h>
 using namespace std;
// Function name: reverse_array
 // Purpose: Reverse the content of array
 // Parameters: arr - array of floating numbers,size - size of the array.
 // Return value: void
 void reverse_array(float arr[],int size)
 {
 int low = 0,high = size-1;
 float temp;
   
 while(low<high)
 {
 temp = arr[low];
 arr[low] = arr[high];
 arr[high] = temp;
 low++;
 high--;
 }
 }
int main()
 {
 float arr[10];
   
 for(int i=0;i<10;i++)
 {
 cout << \"Enter number \" << i+1 << \" in array : \";
 cin >> arr[i];
 }
   
 cout << \"Original Array : \";
 for(int i=0;i<10;i++)
 {
 cout << arr[i] << \" \";
 }
 cout << endl;
   
 reverse_array(arr,10);
   
 cout << \"Reverse Array : \";
 for(int i=0;i<10;i++)
 {
 cout << arr[i] << \" \";
 }
 cout << endl;
   
 return 0;
 }
OUTPUT:
Enter number 1 in array : 1
Enter number 2 in array : 2
Enter number 3 in array : 3
Enter number 4 in array : 4
Enter number 5 in array : 5
Enter number 6 in array : 6
Enter number 7 in array : 8
Enter number 8 in array : 9
Enter number 9 in array : 10
Enter number 10 in array : 1
Original Array : 1 2 3 4 5 6 8 9 10 1
 Reverse Array : 1 10 9 8 6 5 4 3 2 1


