Search:

Type: Posts; User: terran9

Search: Search took 0.01 seconds.

  1. Thread: Strange loop

    by terran9
    Replies
    22
    Views
    7,125

    cin.ignore(100,'\n'); That line ignores upto...

    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...
  2. Thread: Strange loop

    by terran9
    Replies
    22
    Views
    7,125

    cin>>Jaar; while(!cin) { cin.clear(); ...

    cin>>Jaar;
    while(!cin)
    {
    cin.clear();
    cin.ignore(100, '\n');
    cout<<"Please reenter answer."<<endl;
    cin>>Jaar;
    }
  3. Replies
    13
    Views
    3,503

    I couldn't get it to work with passing an array...

    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...
  4. Replies
    3
    Views
    1,035

    When I run it, it doesn't crash it just exits out...

    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...
  5. Replies
    13
    Views
    3,503

    Thank you for the reply. I tried compiling your...

    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));...
  6. Replies
    13
    Views
    3,503

    Thank you all for the help. I think it would be...

    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.
  7. Replies
    13
    Views
    3,503

    Thank you for your replies. I need to use an...

    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....
  8. Replies
    13
    Views
    3,503

    C++ Binary Files Problem

    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...
Results 1 to 8 of 8