Explore Westonci.ca, the leading Q&A site where experts provide accurate and helpful answers to all your questions. Connect with a community of experts ready to provide precise solutions to your questions quickly and accurately. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.
Sagot :
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:
https://brainly.com/question/17378192
Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. Thank you for visiting. Our goal is to provide the most accurate answers for all your informational needs. Come back soon. Stay curious and keep coming back to Westonci.ca for answers to all your burning questions.