business program

This is a discussion on business program within the C Programming forums, part of the General Programming Boards category; i have just started a new business. I am creating a program but as C isn't my specialist subject I ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    4

    Question 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");

    while((c=getc(INFO-FILE)) != EOF)
    /*if(isdigit(c)*/
    putchar(c);/*DISPLAYS CHARACTER ON SCREEN*/
    printf("\n");

    break;



    case 2:
    break;

    case 3:
    break;

    default:
    printf("ERROR***** ERROR******ABORT******\n");

    }
    return; /*FINISH*/
    }

  2. #2
    Registered User jasrajva's Avatar
    Join Date
    Oct 2001
    Posts
    99
    you have got the skeleton code ready
    what you really need to do is seach google or someplace for linked lists and read up on them
    they are very simple really and shouldnt take you more than a coupla hours to get your program running

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  2. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 01:27 PM
  4. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21