Like Tree1Likes
  • 1 Post By AndrewHunter

C++ library management!!

This is a discussion on C++ library management!! within the C++ Programming forums, part of the General Programming Boards category; Can U help me to code for book issue and book deposit. . . because i have difficulties in this ...

  1. #1
    "PALINDROME"
    Join Date
    Nov 2010
    Posts
    59

    C++ library management!!

    Can U help me to code for book issue and book deposit. . .
    because i have difficulties in this part! plz help me on the project!
    and i really need all your help! . .
    Last edited by [Student]; 09-26-2011 at 05:58 PM.

  2. #2
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    50 posts here and you still haven't figured out how to ask a question. Based on just looking through your code I would suggest:
    1. Stop using char arrays, you should be using std::string
    2. You no longer need conio.h since you defined your own console functions.
    3. There is no need for txt files here, just do IO in binary mode and read/write structs directly
    4. When your program starts, open your "database" and read the whole thing into memory. I would suggest using something like a std::list here. If you are not allowed to use the STL, make your own.
    5. Conversely when your program is done, write out your list into the file.
    6. You are asking us to violate the homework policy; we are not going to do that. Come back with a specific question.

    Make those changes I suggested above, reformat your code, and then post a specific question on what you need help on. Not just a "Can someone finish my homework for me" question.
    Elysia likes this.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  3. #3
    Registered User
    Join Date
    Aug 2011
    Location
    Montreal, Quebec, Canada
    Posts
    73
    Another general piece of advice is not to mix logical components of your applciation. There is no reason why your functions related to GUI should be related to a student. A display function should only know about displaying stuff, not grades and student IDs.

  4. #4
    Registered User
    Join Date
    May 2010
    Posts
    2,698
    In the following snippet:
    Code:
           ifstream read("book.txt", ios::in);
            ifstream read2("book.txt", ios::in);
            ofstream write("temp.txt");
    You should not use read and write for name of your streams. There are member functions with those names already defined and you may get confused as to which you are dealing with, your stream or the member function.

    Jim

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,456
    We are not going to go through all that code mindlessly. You need to be more specific about what you don't understand and post the relevant parts. This is in addition to the rest of what's been said already.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    "PALINDROME"
    Join Date
    Nov 2010
    Posts
    59
    ok , but can u help me a little bit, just an example? because i don't know how to start ...
    Last edited by [Student]; 09-26-2011 at 05:06 PM.

  7. #7
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,456
    On what? You have failed to specify what you need help with.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Quote Originally Posted by [Student] View Post
    Can U help me to code for book issue and book deposit. . .
    because i have difficulties in this part! plz help me on the project!
    and i really need all your help! . .
    Quote Originally Posted by [Student] View Post
    ok , but can u help me a little bit, just an example? because i don't know how to start ...
    For starters don't edit your original post; it makes all our responses pointless. Second, make the changes that have already been given to you and then repost your code with specific questions.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Static library vs Dynamic library
    By Alegomaster in forum C Programming
    Replies: 5
    Last Post: 03-17-2011, 07:26 PM
  2. Library Management Coding
    By sunilplayer in forum C++ Programming
    Replies: 2
    Last Post: 07-28-2007, 08:14 AM
  3. Replies: 19
    Last Post: 01-12-2006, 10:04 AM
  4. Memory management in C
    By nicolas in forum C Programming
    Replies: 2
    Last Post: 03-19-2004, 02:25 PM
  5. Power Mis-management
    By SMurf in forum Tech Board
    Replies: 13
    Last Post: 02-14-2003, 01:28 PM

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