Junior Member
Registered: Nov 2001
Location:
Posts: 1
business program
i have just started a new business. I am creating a program but as C isn't my specialist subject I need some help for this.
This website has come highly recommeneded and I hope you can help me. For the program I want to read from a text
file called which I've called id.txt this contains characters and numbers
The program will then read the numbers and generate a sorted dynamic linked list. I want this to be done from the
(largest to smallest), where each node of the linked list would contain a single integer. The program should then
traverse the linked list the resultant linked list on screen.
I have already stared by readying in the file but am stuck with the link list. What i've done is shown below.
#include<stdio.h>
#include<stdlib.h>
FILE *INFO-FILE; /*FILE POINTER*/
open(char *Myfile)
{
if ( (INFO-FILE = fopen( Myfile,"r")) == NULL)
{
printf("Can't open %s\n",Myfile);
exit(1);
}
}
main(){
int choice;
char c;
printf("\nThis program is designed by David\n");
printf("1 - Reads the text file\n");
printf("2 - creates a linklist between text file\n");
printf("3 - print output\n");
printf("4 - Any other number enter return void\n");
printf("please enter your choice");
scanf("%d",&choice);
switch(choice){
case 1:
open("id.txt");
printf("\n");
printf("\n");
break;
case 2:
break;
case 3:
break;
default:
printf("ERROR***** ERROR******ABORT******\n");
}
return; /*FINISH*/
}