Original Post
I made this factorial number calculator
But what other usages can i give to lists. With this simple techniques i already know by making this small program above.
#include <iostream>
using std::cout;
using std::endl;
int maxnodes = 5;
int i;
int sum = 1;
struct listNode
{
int data;
struct listNode *nextPtr;
};
void main()
{
listNode node[19];
for( i = 1; i <= maxnodes; i++)
{
node[i].data = i;
if(i == maxnodes)
{
node[i].nextPtr = 0;
}
else
node[i].nextPtr = &node[i+1];
}
listNode *iterator = &node[1];
while (iterator != 0)
{
sum = sum * iterator->data ;
iterator = iterator->nextPtr;
}
cout << sum << endl;
}