Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct lista {
- int val;
- lista *next = 0;
- };
- int main()
- {
- int input;
- lista *p, *q;
- q = new lista;
- p = q;
- while (true) {
- cout << "Inserisci valore: ";
- cin >> input;
- if (input==0) {
- break;
- }
- p->val = input;
- p->next = new lista;
- p = p->next;
- }
- p = q;
- while (p->next!=0) {
- cout << p->val << " - " << p->next << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement