30 lines
623 B
C++
30 lines
623 B
C++
#include <iostream>
|
|
#include<iomanip>
|
|
using namespace std;
|
|
|
|
typedef struct bookNode {
|
|
string id;
|
|
string name;
|
|
double price;
|
|
bookNode *next;
|
|
} book_node, *bookList;
|
|
|
|
bool is_list_empty(bookList *l) {
|
|
if ((*l)->next == NULL) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void display(bookList *l) {
|
|
if (is_list_empty(l)) {
|
|
printf("List is empty\n");
|
|
} else {
|
|
bookNode *temp = (*l)->next;
|
|
while (temp != NULL) {
|
|
cout << temp->id << " " << temp->name << " " << fixed << setprecision(2) << temp->price << endl;
|
|
temp = temp->next;
|
|
}
|
|
}
|
|
}
|