I am trying to input data to an array and then print them by using a function but I am not sure how to organize the code.
#include <iostream>
using namespace std;
void showGrade(double grade[], int size);
int main()
{
    double grade[];
    int size;
    for (int i = 0; i < size; i++) 
    {
        cout << "Please enter the number of grade" << endl;
        cin >> size;
    }
    showGrade(grade, size);
    return 0;
}
void showGrade(double grade[], int size)    //How many grade we have
{
    for (int counter = 0; counter < size; counter++) 
    {
        cout << "Please enter your grades: " << endl;
        cin >> grade[counter];
        cout << "Here are your grades: " << endl;
    }
}
I Expect to see how many grades I input and then show them.
UPDATE 8/28/19
I figured out how to do it in main function successfully. But what I really want is to put them in a seperate function. My new codes have error at the function call which is type name is not allowed and expected a ')'. How do I make it work?
#include <iostream>
using namespace std;
void showGrades(double ar[], int size);
int main()
{
    double ar[20];
    int size;
    showGrades(double ar[size], int size);
    system("pause");
    return 0;
}
void showGrades(double ar[], int size) {
    cout << "Please enter the number of grade "; // array size
    cin >> size;
    cout << "Please enter your grades " << endl;
    for (int i = 0; i < size; i++) {
        cin >> ar[i];
    }
    cout << "The grades you entered are: " << endl;
    for (int i = 0; i < size; i++) {
        cout << ar[i] << endl;
    }
}
 
     
    