Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 16th, 2005, 10:54 AM
Registered User
Join Date: Dec 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default search help

i am trying to make my program achive the following:

    * allow a book to be issued to a user
    * allow a book to be returned by a user
    * allow the library staff to search for a book by author, to report whether it is currently in stock or on loan and to indicate in which area of the library it may be found.

any help would be much appreciated thank you.

so far this is what my program looks like:

#include <iostream>
#include <fstream>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <string>
using namespace std;

const int ACC_MAX = 1000 ;

enum MemberType { Annual, Quarterly } ;

//enum Month { Jan, Feb, Mar, Apr, May, Jun,
// Jul, Aug, Sep, Oct, Nov, Dec } ;

struct Date
  int day;
  int month;
  int year;

struct Name
  string first_name;
  string surname;

struct Address
  string house_no;
  string streetname;
  string streettype;
  string town;

struct libraryMember
  Name name;
  Address address;
  MemberType member;
  Date date;

void process( libraryMember a )
  switch( a.member )
    case Quarterly:
      a.date.month += 1;
      break ;
    case Annual:
      a.date.year += 1;
      break ;

void readFile()
  // assert( argc >= 2 ) ;
  ifstream clientfile( "clients.dat" ) ;

  libraryMember member[ACC_MAX] ;
  int nRead = 0 ;
  string text;
  int nMember;
  int MembershipNo;

  clientfile >> nMember >> text >> text >> text;

  // read data from file and store in the array 'member'
      clientfile >> member[nRead].name.first_name
                    >> member[nRead].name.surname
                    >> member[nRead].address.house_no
                    >> member[nRead].address.streetname
                    >> member[nRead].address.streettype
                    >> member[nRead].address.town
                    >> MembershipNo >> text >> text
                    >> member[nRead].date.day
                    >> member[nRead].date.month
                    >> member[nRead].date.year;

      if ( MembershipNo == 12)
        member[nRead].member = Quarterly;
        member[nRead].member = Annual;

      if ( clientfile )
      cout << member[nRead].name.first_name << " "
           << member[nRead].name.surname << " "
           << member[nRead].address.house_no << " "
           << member[nRead].address.streetname << " "
           << member[nRead].address.streettype << " "
           << member[nRead].address.town << " "
           << member[nRead].member << ". "
           << member[nRead].date.day << " "
           << member[nRead].date.month << " "
           << member[nRead].date.year << " \n";
      nRead++ ;
    } while ( clientfile && nRead < ACC_MAX ) ;

  cout << nRead << " accounts read\n" ;
  // printf("dfdasf");
  clientfile.close() ;


int main()

  int menu_selection;

  cout << "\n"
      << "================================================= ================\n"
      << " Welcome to fadi younes library system\n"
      << " Bellow is the main menu for the library system\n"
      << " Thank you for choosing public library\n"
      << "================================================= ================\n"
      << " \n"
      << " \n"
      << "Select 1: To view current clients\n"
      << "Select 2: To view current books in library\n"
      << "Select 3: To perform a search through the data for\n"
      << " customers with how many books on loan\n"
<< "Select 4: Exit this program\n\n";

  cin >> menu_selection;

  switch (menu_selection)
    case 1:
      cout << "\n";
      // needs code to read data file
      cout << "\n";
      void current_client();
    int main();
cout <<"Name ; Address ;Membership No"<<endl;
 cout <<"---------------------------------------------------------------;"<<endl;
cout <<"achillios ; 27;old road ;10096"<<endl;
cout <<"bains ; 3;cirrus crescent ;24397"<<endl;
cout <<"christie ; 87;henley deane ;20296"<<endl;
cout <<"deaton ; 4;binney road ;13298"<<endl;
cout <<"edwards ; 19;waterlow street ;17294"<<endl;
cout <<"fishman ; 1;primrose grove ;37502"<<endl;
cout <<"george ; 31;church farm road ;42402"<<endl;
cout <<"griffiths ; 68;ware street ;31095"<<endl;
cout <<"hackett ; 17;maryland drive ;49502"<<endl;
cout <<"hatton ;156;all saints road ;37102"<<endl;
cout <<"ibbotsen ; 13;orchard street ;12293"<<endl;
cout <<"jenkins ; 8;longham copse ;10795"<<endl;
cout <<"khayer ; 85;olivers mill ;43301"<<endl;
cout <<"laskow-pooley ; 42;cedar grove ;11795"<<endl;
cout <<"montgomery ; 5;nursery avenue ;27501"<<endl;
    case 2:
 void current_client();
    int main();
cout <<"Name Of Author ;Name Of Book ;ISBN No"<<endl;
cout <<"---------------------------------------------------------------;"<<endl
;cout <<"Forsyth, Frederick ;The fist of god ;A;102391" <<endl;
cout <<"Follett, Ken ;The pillars of the earth ;A;103795" <<endl;
cout <<"Francis, Clare ;Wolf winter ;A;112424" <<endl;
cout <<"Smith, Wilbur ;A falcon flies ;A;151395" <<endl;
cout <<"Forsyth, Frederick ;The day of the jackal ;A;159151" <<endl;
cout <<"Blackmore, R.D. ;Lorna Doone ;A;193292" <<endl;
cout <<"Smith, Wilbur ;Men of men ;A;292351" <<endl;
cout <<"Smith, Wilbur ;The angels weep ;A;482315" <<endl;
cout <<"James, P.D. ;Cover her face ;D;144371" <<endl;
cout <<"James, P.D. ;Devices and desires ;D;193395" <<endl;
cout <<"Kellerman, Faye ;Stone kiss ;D;434517" <<endl;
cout <<"James, P.D. ;The skull beneath the skin ;D;439518" <<endl;
cout <<"Kelly, Jim ;The water clock ;D;543951" <<endl;
cout <<"Hoag, Tami ;Dark horse ;D;664333" <<endl;
cout <<"Cookson, Catherine ;The silent lady ;R;151611" <<endl;
cout <<"Cookson, Catherine ;Kate hannigans girl ;R;165163" <<endl;
cout <<"Thompson, E.V. ;The lost years ;R;165213" <<endl;
cout <<"Steel, Danielle ;The cottage ;R;177516" <<endl;
cout <<"Binchley, Maeve ;Quentins ;R;261561" <<endl;
cout <<"Alcott, Louisa ;Little women ;R;395104" <<endl;
cout <<"Cookson, Catherine ;Rosie of the river ;R;512843" <<endl;
cout <<"Asimov, Isaac ;Foundation ;S;165108" <<endl;
cout <<"Barker, Clive ;Imajica ;S;172816" <<endl;
cout <<"Barker, Clive ;The great and secret show ;S;174427" <<endl;
cout <<"Barker, Clive ;Weaveworld ;S;282118" <<endl;
cout <<"Clarke, Arthur C ;2001 A space odessy ;S;294561" <<endl;
cout <<"Asimov, Isaac ;Foundation and empire ;S;313178" <<endl;
cout <<"Asimov, Isaac ;Second foundation ;S;549201" <<endl;
    case 3:
    case 4:
      cout << "Thank you for using public library at the university of westminster\n";
      cout << " \n";
      cout << "program director\n";
      cout << "fadi younes\n";


Reply With Quote
  #2 (permalink)  
Old December 16th, 2005, 12:23 PM
Authorized User
Join Date: Nov 2005
Location: , , India.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts

Huh!! what is this...may god bless u guys

Reply With Quote
  #3 (permalink)  
Old January 13th, 2006, 06:07 AM
Authorized User
Join Date: Jan 2006
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts

Actually I already have a program a bit like yours but it's in visual c++ and my data is in an access database. will it be of any help to you.


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search button doesn't search Access DB cbones Visual Studio 2008 1 October 27th, 2008 07:36 PM
New text search doesn't preselect search string planoie Visual Studio 2005 0 July 23rd, 2007 06:47 AM
File Search / Indexing Search with .net 2.0 maulik77 ASP.NET 1.0 and 1.1 Basics 2 March 15th, 2007 12:45 AM
Search Engine for Full-text Search Kala ASP.NET 1.0 and 1.1 Professional 2 August 29th, 2004 02:16 AM
Search engine that search through local drive! wenzation Classic ASP Basics 0 August 26th, 2003 09:15 PM

All times are GMT -4. The time now is 09:33 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.