I have write this program,how to sort the numbers?
// ddd.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
using namespace std;
struct nodeType
{
int data;
nodeType *link;
};
nodeType *head;
int main()
{
//
// Init the list
//
nodeType *first;
nodeType *last;
nodeType *newNode;
int num;
first = NULL;
last = NULL;
//
// Build the list the forward approach
//
for (int i=0; i<5; i++)
{
cout << "Enter number :";
cin >> num;
newNode = new nodeType;
newNode->data = num;
newNode->link = NULL;
if (first == NULL)
{
first = newNode;
last = newNode;
}
else
{
last->link = newNode;
last = newNode;
}
}
//
// Display the list
//
system("PAUSE");
return(0);
}