Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. void printSpecifiedElement()
  2. {
  3. int id;
  4. cout << "Enter ID of student to be printed: " << endl;
  5. cin >> id;
  6. if (first == 0)
  7. {
  8. cout << "No students available!" << endl;
  9. }
  10. else
  11. {
  12. temp = first;
  13. while (temp->next != 0 && temp->id != id)
  14. {
  15. temp = temp->next;
  16. }
  17. if (temp->id == id)
  18. {
  19. cout << "Match found!" << endl;
  20. cout << "Student ID = " << temp->id << endl;
  21. cout << "Student score = " << temp->score << endl;
  22. cout << "Student gender = " << temp->gender << endl;
  23. }
  24. else
  25. cout << "No match found!" << endl;
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement