ok so the first part of my assignment was to write a program that used arrays to calculate the max number, minimum numbers, and average number. i completed that part and the second part of the assignment was to write the same program using the following functions
int main();
void take_input(int A[]);
float Calculate(int A[]);
void print_output(int A[]);
and not allowed to use global variables. if anyone could help me i would appreciate it im new to c++ second week and im not very familiar with arrayas and functions. here is my cod
CODE
#include <iostream>
using namespace std;
int main()
{
int item[10000];
int sum;
int counter;
float numbers;
float avg;
double largest;
// AVEREAGE N NUMBERS
cout<<"how many numbers do you want to average: ";
cin>>numbers;
cout<<"Enter Numbers To Avg; ";
sum = 0;
for (counter=0; counter < numbers; counter++)
{ cin>>item[counter];
sum = sum + item[counter];
}
cout<<endl;
avg = sum/numbers;
cout<<"The Avg of the numbers is equal to "<<avg<<endl<<endl;
// MAX NUMBER
int max = item[0];
for (int counter=1;counter<numbers;counter++)
{
if(max<item[counter])
max=item[counter];
}
cout<<"The Max Numbers Is: "<<max<<endl;
// MINIMUM NUMBER
int min = item[0];
for (int counter=1;counter<numbers;counter++)
{
if(min > item[counter])
min = item[counter];
}
cout<<"The Min Numbers Is: "<<min<<endl;
// Greater Or Less Than Avg
cout<<endl;
for (counter=0; counter < numbers; counter++)
{
if(item[counter] > avg)
cout<<item[counter]<<" Is greater than avg"<<endl;
if(item[counter] < avg)
cout<<item[counter]<<" Is less than avg"<<endl;
if(item[counter] == avg)
cout<<item[counter]<<" Is equal to avg"<<endl;
}
system("pause");
return 0;
}