~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

you did not code the class constructor or destructor.

Hmm..I don't think that makes a difference in this case since the object will be created irrespective of the initialization of the member variables and desctructors in such small programs are as such better left alone...

I am using this now:

void parseFile(ifstream& in)
{
    string tmp;
    Opra_record rec; // = new Opra_record;
    while(!in.eof()) {
        in >> rec;
    }
}

You forgot to incorporate the tips given to you.
And basically what you are doing is going in the wrong direction. You need not put the while loop in the parseint( ) function but in the overloaded friend function. Something like:

std::ifstream& operator>>(std::ifstream& in, Opra_record& r)
{
    string temp ;
    while( in >> temp )
    {
         // create accessor function for each private variable so that
         // you can retrieve them later from any part of the program
         r.get_string_data().push_back( temp )  ;
     }
}

void parseFile(ifstream& in)
{
    Opra_record rec = new Opra_record( );
    in >> *rec;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Dragon-

I will include my full code below, I had edited out a few things for brevity.

Why do you not construct the Opra_record here:

Opra_record* rec; // = new Opra_record;

Your friend function expects a reference to an instance of Opra record, it doesn't matter whether that Opra record has been statically or dynamically created.

Do something like:

Opra_record* rec = new Opra_record( ) ;
// and then use it as
while( in >> *rec )
{
   // your code here
}

OR

Opra_record* rec = new Opra_record( ) ;
Opra_record& ref_rec = *rec ;
while( in >> ref_rec )
{
   // your code here
}

Since I don't have a compiler right now, I havent tested the code, but it should pretty much work out to be well...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

and had a

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a real fast processor with 4 MHz speed.

I put in Intel Dual Core.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

if we all

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

lizard -> moth eater

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get torrential rains

I put in both JJ__ and roryt, just for the fun of it...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

target -> heat seeker

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I think it

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

hallicunation and nothing..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a Sentinel CD

I put in a bench..;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Saliva -> click click boom

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Post the recent code with code tags..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I sometimes wonder where you come up with all the links form (flash games, cool sites...)
;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there buddy, welcome to Daniweb..:D

And as far as your query is concerned, head over to the MySQL and PHP section for help..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there Matt welcome to Daniweb...:D

Head over to the website development section of the forum for your site and see if you can find the solution to your problem...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there Bassgeek welcome to Daniweb...

Head over to the spyware section of the forum and you will find many newbies in search of expert advice...:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there buddy welcome to Daniweb.

And yes its a good thing not to pretend things you know since it just ends up slowing the learning process.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Only 2 people who are married in this entire forum (I guess Miss Narue and Mr. Dragon).....heh

I thought I would get advice from the married pros but we seem to be lacking them here ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

your mind but...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Is this thread going in the right direction...?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a tubewell

I put in Firefox

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

wibble -> dribble

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

this sad state

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Welcome to Daniweb Mr. PHP'er...:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

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...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

psychology -> sanitarium ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Understatements are opposite of Hyperboles..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The call to ignore() should come before the call to getline(), not after, if you are going to use it at all.

It should come after the first time you are accepting input from the user and expect the stream to be corrupted. What reason does it serve to place the ignore before getline when there is no attempt to read from the user and hence no chance of stream coruption.

Read this and this. In each case, ignore is used after accepting user input.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Of course no marriage is perfect, and we had our ups and downs just like many others. I think the trick to a long and reasonably happy marriage is to never go to bed mad at your partner. whatever disagreements you may have had during the day should be resolved before then.

Yes -- I get to hear that thing from a lot many elders out here..Looks like you really are ancient Mr. Dragon.

Although I don't know of many married pole dancers who program in their spare time.

So now we know that she is also a pole dancer....:D

Dating, would take Jwenting into a territory where the logic of computer science no longer exists. He doesn't like that kind of uncertainly.

:P
But what about you eh...;)

Women have burned me deep-- I have not yet forgone the strength of love and romance.

It really is a brave thing that after been through so much you still hold respect for this relationship...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

ok well i think this is what you meant

No..I meant this..

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

cin.ignore() is basically used for cleaning the junk from the stream, which is basically left there when string input is accepted from the user. Since accepting GPA and Major involves accepting non string values, you don't need a ignore since there is nothing to ignore.

For exceptions you can look here.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

touch -> Emotions

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

too shy to talk to women in the wild, and the domesticated kind I have as colleagues are all married or engaged (sometimes to other colleagues).
And before I encountered such domesticated females it was simply too expensive to search them out, even had I dared to.

Come on Mr. Jwenting, you can surely impress them with your knowledge of Java..;) Maybe create a thread in Geek's Louge with subject "A cool Java Pro looking for a pro Java girl"...:D

>Are you married or not ?
Yes. ;)

So much we gathered from Mr. Iamthwee...;)

>If yes then what did marriage change in your life, are the new found
>responsibilities burdening you or making you a better person ?
What didn't it change? :rolleyes:

Change is certain, but total change ....(bah how am I to know..;))

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Thats it..

Are you married or not ?

If not then what are your views on marriage, how do you people see marriage as ?

If yes then what did marriage change in your life, are the new found responsibilities burdening you or making you a better person ?

Regards,
~s.o.s~

PS: I am single and for me marriage is a sacred relationship...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

sense -> feel

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

love on my

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a sarcastic moderator...

I put in Miss Narue ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

"Name" is undefined becauase the name which you want to access is a member of the structure student whose reference you passed to the function. So in order to change it you must access the "Name" variable via the struct instance or variable.

cout << "please enter your name: " << endl;
cin.getline(Name, 30);

// correct usage...atleast in your case
cin.ignore( 30, '\n' ) ;

cout << "Please enter your GPA: ";

// wrong way of accepting a floating point data, GPA is not a string 
// but a float so just use normal cin
cin.getline Student[index].GPA;

cout << "Please enter your Major: ";

//syntax error, see above for current use
cin.ignore Student[index].Major;

Also your logic seems to be incorrect and you are messing up between accepting data for one and multiple student variables. So you either:

1. Create an array of student variables and call get_student( ) method only once.
2.Create three seperate variables and call get_student( ) method three times.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

But since either..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there buddy, welcome.

Hope you get maximum knowledge of VB here..;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yep head over to the IRC channel of Daniweb and chat all you want..

And btw welcome to Daniweb. ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Ah..another Simpsons lover..

Welcome to Daniweb :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hello there and welcome to Daniweb.

Post your question in the Hardware > Storage section to get quick help.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Bleh....;)

Welcome to Daniweb....:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there buddy, welcome to Daniweb....:D

And please post your question in appropriate forum to get quick response.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there buddy, welcome to Daniweb....:D

Maybe you should post your question in the correct forum...like the Microsoft Windows > Software forum.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there buddy, welcome to Daniweb....:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

happy with your

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get XII

I put in an elf

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

seperation -> pain