Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- struct Book
- {
- string author;
- string title;
- int ISBN;
- Book* next;
- };
- int main()
- {
- Book* head = NULL;
- Book* first = new Book;
- first->author = "Bush";
- first->ISBN = 3444;
- first->title = "progInCPP";
- first->next = NULL;
- head = first;
- Book* temp = head;
- for (int i = 0; i < 5; i++)
- {
- while (temp != NULL)
- {
- Book* first = new Book;
- first->author = "Bush";
- first->ISBN = (i * 2 + (101));
- first->title = "progInCPP";
- first->next = NULL;
- head = first;
- }
- }
- while (temp != NULL)
- {
- cout << temp->author << endl;
- cout << temp->ISBN << endl;
- cout << temp->title << endl;
- temp = temp->next;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement