I still don't see why you need a for loop to obtain user input in GetStudent() if you are passing it a single parameter which is a reference to type Student? Please post your most recent version of GetStudent() and maybe it will make more sense.

ok, this is what i am suppose to do word for word:

Create a function, GetStudents, which will receive the array and an int representing the count(2). In the function loop thru the data and get all three fields from the user using cin, cin.getline and cout statements. Organize like this: for (...........) { cout and cin.getline for name cout and cin for GPA cout and cin for Major cin.ignore(1); } The problem is that a cin for a numeric will leave the ENTER key in the keyboard buffer and that is OK with cin and other numbers but not with strings, thus we must remove it on our own.

and here is my code for student.

Student GetStudent(Student &s3)
{
     for( count = 0; count < 2; ++count)
     {
          cout << "please enter your name: " << endl;
          cin.ignore( 30, '\n' ) ;
          cin.getline(s3.Name, 30);
          cout << "Please enter your GPA: ";
           //cin.getline(GPA);
          cin >> s3.GPA ;
          cout << "Please enter your Major: ";
          cin >> s3.Major ;
      }

....and that is why i need to use a for loop.

>>Create a function, GetStudents, which will receive the array and an int representing the count(2).

That should look something like:

void GetStudents(Student studentArray[], int count)

not

Student GetStudent(Student &s3)

>>Organize like this: for (...........) cout and cin.getline for name cout and cin for GPA cout and cin for Major cin.ignore(1);

You instructor assumes that there isn't any input using >> before the first call to getline() in the first iteration of the loop so they want you to put the call to ignore after the last >> in each iteration of the loop and before the call to getline() in the next iteration of the loop. I think it's illogical, as I've pointed out earlier, but since that's the way they want you to do it, then do it that way.

for
{
    cin.getline
    cin >> 
    cin >> 
    cin.ignore
}

I've already posted a program that does almost exactly this that you can reference, though I forgot to change s3 to studentArray in GetStudent() with my copy and paste as I went from one program to the other, but that error has already been pointed out.

ok so change to this void GetStudents(Student studentArray[], int count) in both begining of program and again in the actual function that just so happens to be at the end of the program?

and then in the for i do that those as cin >> not cout <<'s?
you also said you have a similar program where is it?

However, how can you be absolutely certain that the stream is empty or that >> hasn't been called before getline(), particularly in a modular program where the exact sequence of calls may not be predictable?

...because I take care that a cin.ignore() always follows the getline( ) or cin used anywhere in the program. But yes, matter of personal style...

>>you also said you have a similar program where is it?

Page 1 post #14 in this thread contains four programs using structs.
1) Struct mimicking C style structs, that is where the struct has no member fucntions, just member variables. Uses just a single struct object.
2) C++ style struct where functions to manipulate member variables are encapsulated into the struct itself as member functions (aka methods). Uses just a single struct object.
3) Array of structs without freestanding functions.
4) Array of structs with freestanding functions.

You seem to have problems figuring out when to use a single object or a group (aka array) of objects so I thought the progression of programs demonstrating the increased complexity involved step by step may be of assistance.

>>the actual function that just so happens to be at the end of the program

There is no "actul function". Functions need to have a return type, name, list of parameters, body, definition, and prototype. To use the function there also has to be a function call with a list of arguments. Functions may be defined before main() in which case the definition is the prototype. Or they may be defined after main() in which case you do need a prototype before main(). Another level of sophistication down the road will be to put the functions and objects and classes that go together in a header file and link it to the program without actually showing it when you write the program itself, similar to what happens when you include the iostream header file that was written by someone else before you linked it to your program by including it at the beginning of the program.

ok, this is what i am suppose to do word for word:

Create a function, GetStudents, which will receive the array and an int representing the count(2). In the function loop thru the data and get all three fields from the user using cin, cin.getline and cout statements. Organize like this: for (...........) { cout and cin.getline for name cout and cin for GPA cout and cin for Major cin.ignore(1); } The problem is that a cin for a numeric will leave the ENTER key in the keyboard buffer and that is OK with cin and other numbers but not with strings, thus we must remove it on our own.

and here is my code for student.

Student GetStudent(Student &s3)
{
     for( count = 0; count < 2; ++count)
     {
          cout << "please enter your name: " << endl;
          cin.ignore( 30, '\n' ) ;
          cin.getline(s3.Name, 30);
          cout << "Please enter your GPA: ";
           //cin.getline(GPA);
          cin >> s3.GPA ;
          cout << "Please enter your Major: ";
          cin >> s3.Major ;
      }

....and that is why i need to use a for loop.

I have already told you TWICE how to do that. Possibly you did not understand what I posted. Go back and re-read some of the previous posts that mention that function. THE PARAMETERS ARE INCORRECT AND YOU MUST CHANGE THEM.

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.