Debian Codegraph @

help/figures/fig0647.cpp

raw symbols SCIP
1 // File: fig0647.cpp
2 // Computer Systems, Fourth Edition
3 // Figure 6.47
4
5 #include <iostream>
6 using namespace std;
7
8 struct node {
9 int data;
10 node* next;
11 };
12
13 int main () {
14 node *first, *p;
15 int value;
16 first = 0;
17 cin >> value;
18 while (value != -9999) {
19 p = first;
20 first = new node;
21 first->data = value;
22 first->next = p;
23 cin >> value;
24 }
25 for (p = first; p != 0; p = p->next) {
26 cout << p->data << ' ';
27 }
28 return 0;
29 }