cin.ignore(100,'\n');
That line ignores upto 100 characters or the enter key witch ever comes first. Without doing so if you only typed in a single character everytime it would be ok but if you...
Type: Posts; User: terran9
cin.ignore(100,'\n');
That line ignores upto 100 characters or the enter key witch ever comes first. Without doing so if you only typed in a single character everytime it would be ok but if you...
cin>>Jaar;
while(!cin)
{
cin.clear();
cin.ignore(100, '\n');
cout<<"Please reenter answer."<<endl;
cin>>Jaar;
}
I couldn't get it to work with passing an array of pointers to students to the binary file, so I had an object equal what the pointer was pointing to then I passed the object. However, I still...
When I run it, it doesn't crash it just exits out because in your if statements you return a value so it thinks the main function is over. Add system("PAUSE"); before all your return statements to...
Thank you for the reply. I tried compiling your code you posted but I got an error.
fin.read((char *) s1, sizeof(Student1));
I had to change it to
fin.read((char *) &s1, sizeof(Student1));...
Thank you all for the help. I think it would be easier if I just posted a zip file containing all the files so you can see how everything is declared etc.
Thank you for your replies. I need to use an array of student pointers as opposed to an array of students. I've tried doing
out.write((char*)(arr[y]),sizeof(student));
vs....
Hi, I'm trying to create a program that has a class called student which holds a name, age and gpa. Then in my main I want to create an array of student pointers. Then I want the user to be able to...