I triying to write a program with array and functions. But it's realy hard to solve it with my restricted knowledge. Help me please. The problem is:

Write a program where a user can insert integers to an array, find an integer (i.e. find
the index of an integer previously entered and if it is inserted before) and find the
average, sum and maximum of the integers inserted at any time.

User can enter 100 integers at most (i.e. you should have an array of 100 integers)
You should write functions as

int find(int arr[], int i, int x);
this function receives the array and the current number of elements(i) and the
number that is being searched (x) as arguments and returns the index of the element
if it is found in the arrayand returns -1 if x is not in the array.

int sum(int arr[],int i);
this function receives the array and the current number of elements(i) as arguments
and returns the sum of the elements in the array

int max(int arr[],int i);
this function receives the array and the current number of elements(i) as arguments
and returns the maximum of the elements in the array

Recommended Answers

All 2 Replies

I triying to write a program with array and functions. But it's realy hard to solve it with my restricted knowledge. Help me please. The problem is:

Write a program where a user can insert integers to an array, find an integer (i.e. find
the index of an integer previously entered and if it is inserted before) and find the
average, sum and maximum of the integers inserted at any time.

User can enter 100 integers at most (i.e. you should have an array of 100 integers)
You should write functions as

int find(int arr[], int i, int x);
this function receives the array and the current number of elements(i) and the
number that is being searched (x) as arguments and returns the index of the element
if it is found in the arrayand returns -1 if x is not in the array.

int sum(int arr[],int i);
this function receives the array and the current number of elements(i) as arguments
and returns the sum of the elements in the array

int max(int arr[],int i);
this function receives the array and the current number of elements(i) as arguments
and returns the maximum of the elements in the array

You got us confused with "rentacoder-O-rama". If you do not post what you have tried on your own, guess what?: "No-morre supp forr yourr" You'll have to find another establishment.

commented: Seinfeld rep +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.