I am trying to write a code to search a class

This is a discussion on I am trying to write a code to search a class within the C++ Programming forums, part of the General Programming Boards category; not sure what i am doing wrong can someone please explain program compiles fine, when ran it crashes. this is ...

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    38

    Exclamation I am trying to write a code to search a class

    not sure what i am doing wrong can someone please explain

    program compiles fine, when ran it crashes.

    this is the code i am using

    Code:
     int tempID;
                         cout << "Please enter the Student ID number\n";
                         cin >> tempID;
                         for (int i=0; i < total; i++)
                              if (tempID == student[i].getID())
                                  cout << student[i].getFullName();
    
                         break;
    this is the error that i get
    *__result = *__first;
    not sure what this means
    any help appreciated

    jessie

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    the code provided seems to be ok.
    Probably problem is somewhere else
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,319
    >> this is the error that i get
    Can you provide the full error text? How is student declared? If it is a vector, what is student.size() ?

  4. #4
    Registered User
    Join Date
    Nov 2006
    Posts
    38
    actually I switched the things being compared and it worked great!

    Code:
    (student[i].getID()== tempID)
    thanks for all this ideas
    jess

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I need the code of few programs in c++.plzzzzz help...plzzz
    By NAVINKR20 in forum C++ Programming
    Replies: 1
    Last Post: 05-08-2009, 09:13 AM
  2. Search for patterns in source code
    By MiamiCuse in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-23-2005, 11:28 PM
  3. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  4. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 11:38 AM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21