hy to all members of Daniweb

im a finance student currently taking computer programming course, im kinda shy to post it here actually coz im not good in IT nor programming. im really really new in C++, im having problem with my assignment. hope that all the seniors here could help me to finish it. thank you =)

so here's the question

Question 1

a. Write a program that uses an one-dimensional array to store five numbers. The program should output a menu that allows user to select any one of the following tasks; the highest number, the lowest number, the odd number(s), the even number(s). Calculate average amount stored and sort these numbers in the array. Your program must include the following functions:

• Function createArray: This function accepts five numbers from 1 to 100 and stores these numbers in the one-dimensional array. This function also displays all these numbers.

• Function displayMenu: This function displays the menu for user to choose. If user enters an invalid number, the program displays error message and prompts user to enter a new selection. Your menu should be designed as follow:

1. Display highest number in the array

2. Display lowest number in the array

3. Display odd number(s) in the array

4. Display even number(s) in the array

5. Display average of of the numbers stored in the array

6. Sort numbers in the array

7. End program

• Function displayHigh: This function displays the highest number stored in the array.

• Function displayLowest: This function displays the lowestt number stored in the array

• Function displayOdd: This function displays the odd number(s) stored in the array.

• Function displayEven: This function displays the even number(s) stored in the array.

• Function displayAverage: This function calculates the average amount stored in the array.

• Function sortArray: This function sorts and displays these numbers in ascending order.

The following C++ code must be in your program.

#include <iostream>

#include <ctime>

using namespace std;

void createArray (int []);

void displayMenu (int []);

void displayHigh (int []);

void displayOdd (int []);

void count30to70 (int []);

void displayAverage (int []);

void sortArray(int []);

int main()

{

int numbers[5] = {0};

createArray(numbers);

displayMenu(numbers);

return 0;

}

i've made the source code, tried to fix the error but ends up with more errors.

```
#include <iostream>
#include <ctime>
using namespace std;
void createArray (int []);
void displayMenu (int []);
void displayHigh (int []);
void displayOdd (int []);
void count30to70 (int []);
void displayAverage (int []);
void sortArray(int []);
int main()
{
createArray(numbers[i]);
displayMenu(menu[0],menu[1], menu[2], menu[3]);
return 0;
}
void createArray (int numbers[0], int numbers[1], int numbers[2], int numbers[3],int numbers[4])
{
for(int i = 0; i < 4; i++){
do {
cout << "Enter 5 numbers from 1-100 : ";
cin >> numbers[i];
} while(numbers[i] < 0 || numbers[i] > 100)
}
}//end for createArray
void displayMenu ( int i = 0; i < 3; i++)
{
int menu[4] = {0, 1, 2, 3};
cout << "MENU" << endl;
cout << " High[0],Odd[1], Count 30-70[2], Display average[3]" << endl;
cin >> menu[i];
switch (menu) {
case 0:{
void displayHigh ( int max)
{
double max = 0.0;
for ( int numbers[i] = 1; i < 100; i++ )
if ( numbers[i] > max )
cout << "The Maximum number is: " << max;
break;
}
}
case 1:{
void displayOdd ( int odd)
{
for (int i in createArray)
{
if (numbers[i]%1 == 0, i <= 100, i++)
do {
cout << "The odd numbers are: " << odd[i];// to list all odd numbers
} while(numbers[i] < 0, numbers[i] <=100);
}
}
break;
}
case 2: {
void count30to70
{
for (int i in createArray)
{
if (numbers[i]=30, i <=70)
count = // dont know how to code it
}
}
break;
}
case 3: {
void displayAverage (int numbers[0],int numbers[1], int numbers[2], int numbers[3],int numbers[4])
{
average = (numbers[0] + numbers[1] + numbers[2] + numbers[3] + numbers[4])/5;
cout << "The average is: " << average;
}
break;
}
default: {
cout << "Wrong input";
}
}//end of void displayMenu
}
```

thanks again