New and cant get function calls

not sure why but none of my function calls are working the funcctions themselves have out put when i make them programs on their own but as functions all that outputs is "hello." I'm new and really stuck been trying for a week now, any help would be appreciated. bellow is my main function with the calls. array_ in the name is just so i can keep track of what array is in what function.

void main()
{
cout << "\nhello. \n";

void array_names(string &name, string, string, string, string);
{
}
void array_letter_grade(char, char, char, char);
{
}
void array_grade1(double, double, double, double);
{
}
void array_grade2(double, double, double, double);
{
}
void array_grade3(double, double, double, double);
{
}
void array_grade4(double, double, double, double);
{
}
void array_grade5(double, double, double, double);
{
}
void array_average(double, double, double, double);
{
}
system("pause");
}
You're putting function declarations in another function's body. They're not called.
Let me explain your code.

1
2
3
4
5
6
7
8
9
10
11
12
13
void main()
{
    cout << "\nhello.\n";    // print hello to the screen
    
    void array_names(...);    // telling the compiler I have a function called array_names

    {
    }    // doing nothing

    ... // same as above

    system("pause");
}


In C/C++, you can't implement a function inside another function. You have to do it like this:

1
2
3
4
5
6
7
8
9
void array_names(...)
{
    // your implementation to array_names
}

void main()
{
    array_names(...);    // call array_names
}
Last edited on
thank you
Topic archived. No new replies allowed.