I'm Requested to develop a C program

This is a discussion on I'm Requested to develop a C program within the C Programming forums, part of the General Programming Boards category; I gave up with developing my first big program, so i told myself to visit you hoping for some help. ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    9

    I'm Requested to develop a C program

    I gave up with developing my first big program, so i told myself to visit you hoping for some help.

    The problem is A "Library Cataloging System", It consists of records and the user is allowed to add, remove and update an existing record, the file should be encrypted/ decrypted and it's shouldn't work only on one harddisk, by checking the Serial Number.

    So Step one :
    Variables :

    Book_Id
    Book_Name
    Book_Author
    Book_PublishingDate


    Next come the Functions: How many and what tasks needs to be assigned a function???

    PLease help, even with one word, because i'm really a bad programmer

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    247
    Would only be too glad to help, but I don't know if you could afford or be willing to pay me the 40 pounds an hour rate I would charge. Then again, if I see you have at least made an effort, then maybe I would throw a few pointers your way for free.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    PLease help, even with one word, because i'm really a bad programmer
    #include

    Ok, someone one else can do the next word...

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    73
    40 pounds an hour!?!?!?!?! JEEZE! lol.

    I would help you, but I'm also working on my own dataBase program and I want to finish it before I start programming/help-programming another program. Sorry

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    247
    Oops 40 pounds an hour, maybe I meant 4, sorry about the zero.
    hoping to be certified (programming in c)
    here's the news - I'm officially certified.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by bigtamscot
    Oops 40 pounds an hour, maybe I meant 4, sorry about the zero.
    Why sorry? That sounds reasonable, if not on the inexpensive side. Seriously, ever price contractual programming?

    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    #include <stdio.h>
    There, that's my money earnt!

    And here's some more:
    Code:
    #define MAXL_BOOKNAME   100
    #define MAXL_BOOKAUTHOR 50
    #define MAXL_DATE       20
    
    typedef struct Record
    {
      int   Book_Id;
      char  Book_Name[MAXL_BOOKNAME];
      char  Book_Author[MAXL_BOOKAUTHOR];
      char  Book_PublishingDate[MAXL_DATE];
      /* Or you could use this: */
      time_t  Book_PublishingDate;
    } Record_t;
    You have a lot of work to do, break it down in to sections. File IO, encryption/decryption, data lists in memory (creation, manipulation etc), user interaction etc etc. Work on it in chunks first, get comfortable with what you're doing, then try putting it all together.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  8. #8
    Rog
    Rog is offline
    Registered User
    Join Date
    Jan 2003
    Posts
    78
    You asked about functions: how many and what tasks...

    Start with the functions that your program will perform.

    You said: add, remove, and update.

    Each one of these will be a function.

    You can use a do while loop in main with a switch that has those three options plus one to quit the program.

    Now you have 4 functions including main. You may decide to add some other functions, for example one to read and decrypt, and another to write and encrypt.

    Now start with the add function. What happens when you add a book (I'll go with book for example here) to a library catalog? What information is required to add the book? You will need to get that information prior to adding the record.

    With remove and update you will need to do the same things as you do in add, except instead of just appending another record to the file, you will need to look-up a record and if that record does not exist let the user know about it. If you find the record you will need to either remove it or update it.

    You can add a deleted flag to the Record_t type. This will allow you to keep track of which records are removed from the catelog and to compress the file from time to time.

    For IO you should use fread and fwrite. Use sizeof(Record_t) in the size parameter to read or write the correct number of bytes in a record.

    In the remove and update functions you will need query the user for a record spec, then read the file one record at a time and compare the user's spec to each record on file until you either find the match or the end of file. There are more effecient ways to do this, but for a simple project like this the sequential method will get the job done.

    -Rog

  9. #9
    Registered User
    Join Date
    May 2003
    Posts
    9

    Thanks for all

    I really was surprised by the quick and many replies. So thanks for all of you.

    Thanks for bigtamscot:
    all what i want is a little help, and check if my work is right, and add some tips.

    Thanks for Quazh:
    i hope you'll add your next word

    Thanks for Nuke:
    if you have some time only to read this thread and add a few words i 'll be grateful

    Thanks for Hammer:
    your post was very valuable for me, thank you very much

    Thanks for Rog :
    You helped me a lot, and i got an idea where to start

    Here are the functions that i will include in my program.

    void addRecord();
    void removeRecord(int RecNum);
    void updateRecord(int RecNum);
    void exit();
    void encrypt( ---- )
    void decrypt( ---- )
    void checkserial( ----- )

    The last one is to check for the serial number,

    Please guys can you tell me if the Elements for the first 4 functions are correct? and what elements should I use in the last 3? and should all the functions be void?

    One more thing: should I start coding the main function first or the other functions?

  10. #10
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    If your list is a global list (ie: a global poitner) then yes, that should work fine for adding/removing. If it isn't, you'll need to pass a pointer to your list so your functions can modify the list.

    Quzah.
    Hope is the first step on the road to disappointment.

  11. #11
    Registered User
    Join Date
    May 2003
    Posts
    9

    thanks quazh

    can I use a global list? (i.e. can encryption/decryption work for global?)

    Another question arose here since i should use variable length record as Mr. Rog said : While Updating a Record, what will happen if the new record is longer than the old one?

    What happens If I want to delete a name in a record?

    New Works in the Project:

    assign Book_Id a primary key.
    and all the others are secondary key.

    Is that OK? and how i can declare a primary key in C?
    Last edited by BadProgrammer; 05-14-2003 at 06:10 AM.

  12. #12
    Registered User
    Join Date
    Mar 2003
    Posts
    102
    Originally posted by quzah
    Why sorry? That sounds reasonable, if not on the inexpensive side. Seriously, ever price contractual programming?

    Quzah.
    I have to agree with quzah on this. If you ever look at www.rent-a-coder.com you see that programs like this usualy go for a lot of money.. Usualy a couple of thousand dollars (american). That is very cheap..


    BadProgrammer. What is the type of system you are using? WIll this be a web-based system? Or a nice pretty GUI system (shudder). or a nice speedy ncurses/cli application?


    As for you data structures. I would use a relational many to many database system. You could use the BerkleyDB system if you are using linux/unix for this database. As for global pointers i think they are a bad idea. You would have to be VERY carefull with how you handle the pointers.
    Last edited by squid; 05-14-2003 at 12:02 PM.

  13. #13
    eh ya hoser, got a beer? stumon's Avatar
    Join Date
    Feb 2003
    Posts
    323
    void exit();
    I would recommend not using this as it is already a function name in stdlib header file.
    The keyboard is the standard device used to cause computer errors!

  14. #14
    Registered User
    Join Date
    May 2003
    Posts
    9
    I have to agree with quzah on this. If you ever look at www.rent-a-coder.com you see that programs like this usualy go for a lot of money.. Usualy a couple of thousand dollars (american). That is very cheap
    I am a student that is studying coding, and i want only some help in which we all we benefit from the information, and the final code will be public for you all.

    BadProgrammer. What is the type of system you are using? WIll this be a web-based system? Or a nice pretty GUI system (shudder). or a nice speedy ncurses/cli application?
    I want to develop this program in a C language, i think it work in both MS-Dos and Unix/Linux. right?
    The program is only a one file containing some records and some lines of code, no such strange DB systems are needed.

    I would recommend not using this as it is already a function name in stdlib header file.
    do you mean that i shouldn't make a function for exiting the program? I'll search this function and understand it better, and if you can help i'll be thankful.

  15. #15
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>do you mean that i shouldn't make a function for exiting the program?
    You shouldn't use names that are already taken by standard functions, like exit().

    If you want your own, you could do something like my_exit() or Exit()
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Page 1 of 2 12 LastLast
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. Replies: 3
    Last Post: 03-04-2005, 02:46 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