Advertisement
Dotunoyesanmi

list

Mar 6th, 2015
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. struct Book
  6. {
  7.     string author;
  8.     string title;
  9.     int ISBN;
  10.     Book* next;
  11. };
  12.  
  13. int main()
  14. {
  15.     Book* head = NULL;
  16.  
  17.     Book* first = new Book;
  18.     first->author = "Bush";
  19.     first->ISBN = 3444;
  20.     first->title = "progInCPP";
  21.     first->next = NULL;
  22.     head = first;
  23.  
  24.     Book* temp = head;
  25.     for (int i = 0; i < 5; i++)
  26.     {
  27.         while (temp != NULL)
  28.         {
  29.             Book* first = new Book;
  30.             first->author = "Bush";
  31.             first->ISBN = (i * 2 + (101));
  32.             first->title = "progInCPP";
  33.             first->next = NULL;
  34.             head = first;
  35.         }
  36.     }
  37.  
  38.     while (temp != NULL)
  39.     {
  40.         cout << temp->author << endl;
  41.         cout << temp->ISBN << endl;
  42.         cout << temp->title << endl;
  43.         temp = temp->next;
  44.  
  45.     }
  46.  
  47.  
  48.  
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement