The program illustrates the use of functions.
Functions are used to group related code segments that act as one, when called.
The program in C++ where comments are used to explain each line is as follows:
#include <iostream>
using namespace std;
//This defines the Average function
float Average(int num1, int num2){
//This returns the average of the numbers
return (num1+num2)/2.0;
}
//The main method begins here
int main(){
//This declares the numbers as integer
int num1, num2;
//This gets input for both numbers
cin>>num1; cin>>num2;
//This is repeated until the user enters 0
while(num1!=0 || num2 !=0){
//This calls the average function, and prints the average
cout<<Average(num1,num2)<<'\n';
//This gets input for both numbers, again
cin>>num1; cin>>num2;
}
return 0;
}
Read more about similar programs at:
brainly.com/question/17378192