0

write a program which fills a 10 element array using a for loop with numbers 90,80,70 etc.
write a function to return the maxi value of the numbers in the array.
write a function to return the average value of the numbers in the array.

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by freudian_slip
1
int main(void) {
     TryYourself();
     if(ProblemArise()) {
          while(NotWorking()) {
               PostYourCode();
               AskForHelp();
               TrySuggestion();
          }
     }
     cout << "Wow, not it works!";
     return EXIT_SUCCESS;
}

Or, if desperate, start here:

#include <iostream>

using std::cout;
using std::endl;

void InputArray(int *myarray);
int GetMax(int *myarray);
int GetAverage(int *myarray);

int main(void) {
     int myarray[10];
     InputArray(myarray);
     cout << "The max value is " << GetMax(myarray) << endl;
     cout << "The average is " << GetAverage(myarray) << endl;
     return EXIT_SUCCESS;
}
0

/high fives mrboolf

sorry for non constructive post but people aren't here to do your hw. They are here to help and guide and point out flaws.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.