Respuesta :
Answer:
Written in C++
#include<iostream>
using namespace std;
int main()
{
int num;
int sum = 0;
cout<<"Input: ";
cin>>num;
int count = 0;
int max = 0;
while(num >= 0)
{
sum+=num;
cin>>num;
count++;
if(num>=max){
max = num;
}
}
cout<<(sum/count)<<endl;
cout<<max<<endl;
return 0;
}
Explanation:
I've added the full source code as an attachment where I use comments as explanation.
See Attachment
The max and the average of the input data will be determined through iterations and conditional statements.
The program in C++ is as follows
#include<iostream>
using namespace std;
int main(){
//This declares num
int num;
//This initializes sum to 0
int sum = 0;
//This prompts user for input
cout<<"Input: ";
//This gets input from the user
cin>>num;
//This initializes counter to 0
int count = 0;
//This initializes max to 0
int max = 0;
//The following iteration gets user input until user enters negative
while(num >= 0) {
//This line calculates the sum
sum+=num;
//This gets another input from the user
cin>>num;
//This increases counter by 1
count++;
//The following if statement checks for maximum
if(num>=max){
max = num;
}
}
//This prints the average
cout<<"Average: "<<(sum/count)<<endl;
//This prints the max
cout<<"Maximum: "<<max<<endl;
return 0;
}
See comments for program explanation
Read more about C++ programs at:
https://brainly.com/question/15410214