I am just learning c++ and, I am trying to create a function out of the lines that are surrounded by stars. I am at my wits end! Does anyone have a suggestion or reference that might help me figure this out.

Here is my code:

int a, b, c, x, y, z; // global variables

double examGrades[100]; // arrays

int getStudentNumber(int studentNumber); // prototypes

int main () // main program
z = getStudentNumber(z); // fn - input student qty.
cout << endl; 


cout << "Enter the EXAM grades for this class: " << endl;

for (y=0; y<=z; y++)
cin >> examGrades[y];


return 0;

int getStudentNumber(int studentNumber)
int students = 1;
cout << "Enter the number of students in the class: "<<endl;
cin >> students;
students = students - 1;
return students;

Edited by WaltP: Added CODE Tags -- please use them.

6 Years
Discussion Span
Last Post by WaltP

I don't see any attempt at trying to make a function. Give it a try, format your code, and repost with CODE tags so we can help you.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.