I am getting a crazy number of errors that i honestly do not know what is wrong. I am getting a syntax errot before the "int"s in the switch, and conflicting types of all the function names. Any help will be appreciated.

#include <stdio.h>
#include <stdlib.h>
#define ARRAY_SIZE 241


void displayMenu();
void getRandomNumbers(int size);
void getDisplayNumbers(int aryData[], int size, int i);
int getCountOver25(int aryData[], int size);
int getAverage(int aryData[], int size, int i, int sum, int avg);
int getMax(int aryData[], int size, int i);
int getMin(int aryData[], int size, int i);


int main()
{
    char choice;
    int over;
    int avg;
    int max;
    int min;


    do {
        displayMenu();
        choice = getche();

        switch (choice)
        {

            case '1' :  getRandomNumbers (int aryData[], int size);
                        break;
            case '2' :  getDisplayNumbers (int aryData[], int size, int i);
                        break;
            case '3' :  getCountOver25 (int aryData[], int size);
                        break;
            case '4' :  getAverage (int aryData[], int size, int i, int sum, int avg);
                        break;
            case '5' :  getMax (int aryData[], int size, int i);
                        break;
            case '6' :  getMin (int aryData[], int size, int i);
                        break;
            case '7' : return 0;

        }

        printf("There are %d numbers over 25.\n", getCountOver25(over));

        printf("The average all the numbers is %d.\n", getAverage(avg));

        printf("The maximum number is %d.\n", getMax(max));

        printf("The minimum number is %d.\n", getMin(min));*/


        return 0;
    }
 while (choice != 7); 
}


void displayMenu()
{
    printf("  Main Menu\n");
        printf("1 Get Random Number\n");
        printf("2 Display Numbers\n");
        printf("3 Count Numbers Over 25\n");
        printf("4 Calculate Average\n");
        printf("5 Find Maximum\n");
        printf("6 Find Minimum\n");
        printf("7 Exit\n");
        printf("Enter Your Choice: ");
}

//***************************************************//

void getRandomNumbers(int size)
{
    int aryData[ARRAY_SIZE];
    int i;
    for(i = 0; i < size; i++)
        i = rand() % 100 + 1;

}
//***************************************************//
void getDisplayNumbers(int aryData[], int size, int i)
{

    for (i = 0; i < size; i++)
        printf("Random numers are: %d \n\n", aryData[i]);
    printf("\n");



}
//****************************************************//


int getCountOver25(int aryData[], int size)
{
    int count, i, over;

    for (i = 0; i < size; i++)
    {
        if (aryData[i] > 25)
        count++;
    }


    return over;
}

//**************************************************///

int getAverage(int aryData[], int size, int i)
{
    //#### to get the sum of all the numbers in the array you need a loop
    int sum = 0, avg;
    sum = aryData[i] + aryData[i+1];
    avg = sum / 240;

    return avg;
}
//**************************************************///


int getMax(int aryData, int size, int i)
{
    int max = aryData[0];

    for (i = 1, i > size, i ++)

    {
        if (aryData[i] > max)
            max = aryData[i]
    }


    return max;

}
//******************************************************//


int getMin(int aryData, int size, int i)
{
     int min = aryData[0];


    for (i = 1, i > size, i++)

    {
        if (aryData[i] < min)
            min = aryData[i];
    }

    return min;

}

Recommended Answers

All 4 Replies

I am getting a crazy number of errors that i honestly do not know what is wrong. I am getting a syntax errot before the "int"s in the switch, and conflicting types of all the function names. Any help will be appreciated.

Then reread the section in your book on how to call a function.

When you call a function, you do not but a space between the function name and the open bracket. Look at your printf function. You call it without the space 'ex: printf()'. So, why do you put a space for your own functions 'ex: getRandomNumbers (int aryData[], int size);'?

comment out lines with errors, then slowly uncomment and look for errors
next time you write something, compile it every time you add something new while you are learning

When you call a function, you do not but a space between the function name and the open bracket.

You've pointed out a case of total irrelevance. Whether the space is there or not changes absolutely nothing, though I agree that it's recommended to be consistent with whatever style you choose.

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.