Welcome to Westonci.ca, the place where your questions find answers from a community of knowledgeable experts. Discover reliable solutions to your questions from a wide network of experts on our comprehensive Q&A platform. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts.
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
Thank you for your visit. We are dedicated to helping you find the information you need, whenever you need it. We hope our answers were useful. Return anytime for more information and answers to any other questions you have. Stay curious and keep coming back to Westonci.ca for answers to all your burning questions.