Thread: Link list help

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    5

    Link list help

    Hi everybody.i have a homework and i cant do it.i am waiting your help


    In this project you will write your own designed database program. Suppose
    that you will write an income program for a family. The family incomes may be
    listed as salary of husband and wife, rent incomes from somewhere. Their expenses
    can be listed as expenses of kitchen, education, health and holiday. Each family’s
    expenses has a different ratio with respect to their incomes, such as kitchen expenses
    may be 14% of their whole incomes, education expenses may be 13% of their whole
    incomes, health expenses may be 4% of their whole incomes, and holiday expenses
    may be 30% of their whole incomes. In your program firstly, you should do the
    followings;

    Assign name and address for each family,
    Assign their incomes,
    Assign the expenses ratio of their incomes.

    Then you should write these data to a binary file from family with a highest income
    to the lowest income. And then, you should design a proper menu which performs
    the followings;

    Assign data for a new family,
    Find a family name from the file showing its net income
    Deleting a family data
    Seek the Name:
    Change Family data

    After you quit the program, you should save everything and your file should be
    arranged at the beginning style.

    In your project, you will not write an income program for a family. This case
    is only an example, however, you may write an income program for hospital or a
    specific company or a school, a university, you may write student database program
    which may involve students midterms, final results, their rations on the final grade.
    This project is based on three parts; write a database for something, write this
    database to a binary file in a specific order. Create a proper, useful, and nice menu
    that allows user different number of choices and and saving everything at the end.

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    We wouldn't really be helping you if we wrote your code for you; you would learn very little about programming that way. You need to try something on your own, and then ask for help when you are stuck. It is against the rules of the board to provide homework for a user. You can read about this here and especially here. When you have got some code hammered out for us to have a look at, make sure you read this about posting code.
    Last edited by kermit; 01-10-2009 at 01:32 PM.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    5
    i can do little. But after it icant do it.because i dont know linklist .i will be happy if you help me..

  4. #4
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Why don't you know how to do linked lists? Is it because your instructor refuses to teach you, or is it because you were not listening during the lectures? No reasonable instructor would expect a student to code a project such as the one you are listing here without first having taught all of the relevant material first. If he did, then you may as well find another instructor, because that class is useless to you. So why is it that you can't do a linked list?

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    5
    C programming is a hard lesson.While students are listening the insructor,they can not learn during the lesson.Also i can not learn the link list.thats why i am asking to you.because i have to do it.if you will help me,i wiil thank you or if not ,you know.but i have to do it.
    thank you for interest

  6. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    5
    how can i add my code here , and how can i send you a private message?I am new member.

  7. #7
    Registered User
    Join Date
    Apr 2008
    Posts
    396

  8. #8
    Registered User
    Join Date
    Jan 2009
    Posts
    5
    thanks root4
    Code:
    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h>
    #include <string.h>
    struct ogrenci{
           char ad[20];
           int evdengelen;
    	   int ogrenim;
    	   int barinma;
    	   int fatura;//kontor adsl elektrik dogalgaz vs..
    	   int yemek;
    	   int yol;
    	   int eglence;
           struct ogrenci *ileri;
    	   struct ogrenci *geri;
    };
    
    struct ogrenci *basla; 
    struct ogrenci *bitir;
    
    struct ogrenci;
    
    /*void menu(){
      printf("\n\n");  
      printf("\t\t1- Kayit Ekle\n");
      printf("\t\t2- Kayit Ara\n");
      printf("\t\t3- Kayit Sil\n");
      printf("\t\t4- Kayit Listele\n");
      printf("\t\t5- Kayit Duzelt\n");
      printf("\t\t6- Cikis\n\n");  
      printf("\tseciminiz -->\t(1/2/3/4/5/6)\n\n");
      }
    */
    void ekle(){
    	struct ogrenci *a1;
    	a1=((struct ogrenci *)malloc(sizeof(struct ogrenci))); //bellekten alani ayirdim.
    
    	printf("\nogrencini adini giriniz");
    	gets("a1->ad");
    
    	printf("\nogrencinin aylik evdengelen parasini giriniz");
    	scanf("%d",a1->evdengelen);
    
    	prinntf("\nogrencinin aylik ogrenim kredisini giriniz");
    	scanf("%d",a1->ogrenim);
    
    	printf("\nogrencinin aylik barinda giderini giriniz");
    	scanf("%d",a1->barinma);
    
    	printf("\nogrencinin aylik fatura giderini giriniz ");
    	scanf("%d",a1->fatura);
    
    	printf("\nogrencinin aylik yemek parasini giriniz");
    	scanf("%d",a1->yemek);
    
    	printf("\nogrenicin aylik yol parasini giriniz");
    	scanf("%d",a1->yol);
    
    	printf("\nogrencinin aylik eglence parasini giriniz");
    	scanf("%d",a1->eglence);
    
    
    
    }
    it is income program for Students i wrote until here..but i dont know link list.i need your help
    Last edited by ofyunus; 01-10-2009 at 02:17 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 04:09 AM
  2. Link List Insert prob
    By Bebs in forum C Programming
    Replies: 8
    Last Post: 12-03-2008, 10:28 PM
  3. reading data from a file - link list
    By peter_hii in forum C++ Programming
    Replies: 7
    Last Post: 10-25-2006, 09:11 AM
  4. compiler build error
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-30-2003, 10:16 AM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM