#include <iostream>
#include <string>
usingnamespace std;
struct node
{
int data;
node * link;
};
int main()
{
int total;
node * head;
head = new node;
head -> data = 5;
head -> link = new node;
head -> link -> data = 6;
head -> link -> link = new node;
head -> link -> link -> data = 7;
head -> link -> link -> link = NULL;
cout << head -> data << endl;
cout << head -> link -> data << endl;
cout << head -> link -> link -> data << endl;
while(link! == NULL)
{
total+= data;
cout << "Total is: " << total;
}
system("pause");
return 0;
}