35 lines
643 B
C++
35 lines
643 B
C++
#include <iostream>
|
|
#include <iomanip>
|
|
|
|
using namespace std;
|
|
|
|
typedef struct node {
|
|
string id;
|
|
string name;
|
|
double price;
|
|
struct node *next;
|
|
} node, book_list*;
|
|
|
|
void init_list(book_list *books) {
|
|
*books = new node();
|
|
(*books)->next = NULL;
|
|
}
|
|
|
|
void create_from_end(book_list *books) {
|
|
node *r = reinterpret_cast<node *>(books);
|
|
node *s = new node();
|
|
do {
|
|
cin >> s->id >> s->name >> s->price;
|
|
if (s->id == "0" && s->name == "0" && s->price == 0) {
|
|
r->next = s;
|
|
} else {
|
|
r->next = NULL;
|
|
}
|
|
} while (r->next != NULL);
|
|
}
|
|
|
|
|
|
int main() {
|
|
return 0;
|
|
}
|