473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

project for library management

i have developed the code for library management
the code is
Expand|Select|Wrap|Line Numbers
  1. # include<iostream.h>
  2. #include<stdlib.h>
  3. #include<fstream.h>
  4. #include<string.h>
  5. # include<conio.h>
  6. class lib
  7. {
  8. protected:
  9. int reg_no[10],year[10],no_cards[10];
  10. char name[20][20],dept[10][10];
  11. static int count;
  12. clrscr();
  13. public:
  14. void create_lib();
  15. void del(int);
  16. void disp_lib();
  17. int search(int);
  18. static void showcount()
  19. {
  20. cout<<"no of people registered"<<count<<"\n";
  21. }
  22. getch();
  23. };
  24. int lib::count;
  25. void lib::create_lib()
  26. {
  27. count++;
  28. cout<<"enter the name \n:";
  29. cin>>name[count];
  30. cout<<"enter the register number \n";
  31. cin>>reg_no[count];
  32. cout<<"enter the department \n";
  33. cin>>dept[count];
  34. cout<<"enter the year \n";
  35. cin>>year[count];
  36. cout<<"enter the number of cards \n";
  37. cin>>no_cards[count];
  38. }
  39. void lib::disp_lib()
  40. {
  41. for(int i=1;i<=count;i++)
  42. {
  43. cout<<"name::"<<name[i]<<"\n";
  44. cout<<"reg_no::"<<reg_no[i]<<"\n";
  45. cout<<"dept::"<<dept[i]<<"\n";
  46. cout<<"year ::"<<year[i]<<"\n";
  47. cout<<"No_cards:: "<<no_cards[i]<<"\n";
  48. }
  49. }
  50. void lib::del(int a)
  51. {
  52. for(int i=a;i<=count;i++)
  53. {
  54. reg_no[i+1]=reg_no[i];
  55. year[i+1]=year[i];
  56. no_cards[i+1]=no_cards[i];
  57. strcpy(name[i+1],name[i]);
  58. strcpy(dept[i+1],dept[i]);
  59. }
  60. count--;
  61. cout<<"successfully deleted";
  62. }
  63. int lib::search(int code)
  64. {
  65. int pos=0,flag=0;
  66. for(int i=1;i<count;i++)
  67. {
  68. if(reg_no[i]==code)
  69. {
  70. pos=1;
  71. flag=1;
  72. }}
  73. if(flag!=1)
  74. pos=0;
  75. return(pos);
  76. }
  77. class boo
  78. {
  79. protected:
  80. int dept_code[10],no_copy[10],book_code[10];
  81. char name_boo[50][50],author[20][20],pub[10][10];
  82. static int coun;
  83. clrscr();
  84. public:
  85. void create_boo();
  86. void disp_boo();
  87. int search(int);
  88. static void showcoun()
  89. {
  90. cout<<"no of books"<<coun<<"\n";
  91. }
  92. getch();
  93. };
  94. int boo::coun;
  95. void boo::create_boo()
  96. {
  97. coun++;
  98. cout<<"enter the name of the book"<<"\n";
  99. cin>>name_boo[coun];
  100. cout<<"enter the department code"<<"\n";
  101. cin>>dept_code[coun];
  102. cout<<"enter the book code"<<"\n";
  103. cin>>book_code[coun];
  104. cout<<"enter the author name"<<"\n";
  105. cin>>author[coun];
  106. cout<<"enter the publishing name"<<"\n";
  107. cin>>pub[coun];
  108. cout<<"enter the no of copies"<<"\n";
  109. cin>>no_copy[coun];
  110. }
  111. void boo::disp_boo()
  112. {
  113. for(int i=1;i<=coun;i++)
  114. {
  115. cout<<"name_boo :: " <<name_boo[i]<<"\n";
  116. cout<<"dept_cod :: "<<dept_code[i]<<"\n";
  117. cout<<"book_code ::  "<<book_code[i]<<"\n";
  118. cout<<"auth_name :: "<<author[i]<<"\n";
  119. cout<<"pub_name ::"<<pub[i]<<"\n";
  120. cout<<"no_copies :: "<<no_copy[i]<<"\n\n\n";
  121. }
  122. }
  123. int boo::search(int code)
  124. {
  125. int pos=0,flag=0;
  126. for(int i=1;i<=coun;i++)
  127. {
  128. if(book_code[i]==code)
  129. {
  130. pos=1;
  131. flag=1;
  132. }
  133. }
  134. if(flag!=1)
  135. pos=0;
  136. return(pos);
  137. }
  138. class len:public boo,public lib
  139. {
  140. int re[10];
  141. char na[50][50];
  142. public:
  143. void check(void);
  144. void time();
  145. };
  146. void len::check(void)
  147. {
  148. lib::disp_lib();
  149. boo::disp_boo();
  150. cout<<"enter the reg_no"<<"\n";
  151. cin>>re[coun];
  152. for(int i=1;i<=coun;i++)
  153. {
  154. if(reg_no[i]==re[i])
  155. {
  156. cout<<"enter the book name"<<"\n";
  157. cin>>na[coun];
  158. for(int i=1;i<=coun;i++)
  159. {
  160. if(name_boo[i]==na[i])
  161. {
  162. boo::disp_boo();
  163. no_copy[coun]=no_copy[coun]-1;
  164. cout<<no_copy[coun];
  165. }
  166. else
  167. {
  168. cout<<"enter the correct book name"<<"\n";
  169. }
  170. }
  171. }
  172. else
  173. {
  174. cout<<"enter the valid data"<<"\n";
  175. }}}
  176. void len::time()
  177. {
  178. int dd,mm,yy,dd1,mm1,yy1;
  179. cout<<"enter the date of issue"<<"\n";
  180. cin>>dd>>mm>>yy;
  181. cout<<"enter the date of return"<<"\n";
  182. cin>>dd1>>mm1>>yy1;
  183. cout<<"date of issue \t:"<<dd<<"/"<<mm<<"/"<<yy<<"\n\n";
  184. cout<<"date of return\t:"<<dd1<<"/"<<mm1<<"/"<<yy1<<"\n";
  185. }
  186. void main()
  187. {
  188. int s=1,x,temp,t,y,z,v;
  189. boo q;
  190. lib p;
  191. len f;
  192. do
  193. {
  194. cout<<"1.Member details\n 2.book details\n 3.lending form\n 4.exit \n";
  195. cin>>y;
  196. switch(y)
  197. {
  198. case 1:
  199. cin>>x;
  200. switch(x)
  201. {
  202. case 1:
  203. p.create_lib();
  204. break;
  205. case 2:
  206. cout<<"enter the reg_no\n";
  207. cin>>temp;
  208. t=0;
  209. t=p.search(temp);
  210. if(t>0)
  211. p.del(t);
  212. else
  213. cout<<"register number not found!!!! please enter the valid number\n ";
  214. break;
  215. case 3:
  216. lib::showcount();
  217. p.disp_lib();
  218. break;
  219. case 4:
  220. s=0;
  221. break;
  222. }
  223. break;
  224. cout<<"\n 1.member details\n2.book details\n3.lending form\n4.exit\n\n ";
  225. cin>>y;
  226. case 2:
  227. cout<<"\nbook details\n1.create\n2.search\n3.display\n4.exit\n";
  228. cin>>z;
  229. switch(z)
  230. {
  231. case 1:
  232. q.create_boo();
  233. break;
  234. case 2:
  235. cout<<"enter the code no\n";
  236. cin>>temp;
  237. t=0;
  238. t=q.search(temp);
  239. if(t>0)
  240. cout<<"book is found\n";
  241. else
  242. cout<<"book not found!!!! pls enter the present book name";
  243. break;
  244. case 3:
  245. boo::showcoun();
  246. q.disp_boo();
  247. break;
  248. case 4:
  249. s=0;
  250. break;
  251. }
  252. break;
  253. cout<<"\n 1.member details\n 2.book details\n 3.lending form\n4.exit ";
  254. cin>>y;
  255. case 3:
  256. cout<<"1.get the book\n2.rem time\n3.exit";
  257. cin>>v;
  258. switch(v)
  259. {
  260. case 1:
  261. f.check();
  262. break;
  263. case 2:
  264. f.time();
  265. break;
  266. case 3:
  267. s=0;
  268. break;
  269. }
  270. break;
  271. case 4:
  272. s=0;
  273. break;
  274. }
  275. }
  276. while(s==1);
  277. }

it is working
but i want to know can i able to connect this program with ms access
if it is possible means how can i do that
can any one help me


and i have one program in vc++,that is used to connect to database.
can i use that code here.
if it ok how can i do.this is my project in college can any one help
vc++ coding is
Expand|Select|Wrap|Line Numbers
  1. #include<windows.h>
  2. #include<sqlext.h>
  3. #include<iostream.h>
  4. int main(void)
  5. {
  6. HENV hEnv = NULL;
  7. HDBC hDBC = NULL;
  8. HSTMT hStmt= NULL;
  9. UCHAR szDSN[SQL_MAX_DSN_LENGTH] = "ds97";
  10. UCHAR* szUID = NULL;
  11. UCHAR* szPasswd = NULL;
  12. UCHAR szModel[128];
  13. SDWORD cbModel;
  14. UCHAR szSqlStr[] = "Select name from table1";
  15. RETCODE retcode;
  16. SQLAllocEnv(&hEnv);
  17. SQLAllocConnect(hEnv,&hDBC);
  18. retcode = SQLConnect(hDBC, szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
  19. HSTMT hStmt1 = NULL;
  20. UCHAR szModel1[128];
  21. SDWORD cbModel1;
  22. UCHAR szSqlStr1[] = "Select accno from table1";
  23. RETCODE  retcode1;
  24. retcode1 = SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
  25. HSTMT hStmt2 = NULL;
  26. UCHAR szModel2[128];
  27. SDWORD cbModel2;
  28. UCHAR szSqlStr2[] = "Select addr from table1";
  29. RETCODE  retcode2;
  30. retcode2 = SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
  31. HSTMT hStmt3 = NULL;
  32. UCHAR szModel3[128];
  33. SDWORD cbModel3;
  34. UCHAR szSqlStr3[] = "Select balance from table1";
  35. RETCODE  retcode3;
  36. retcode3 = SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
  37. if(retcode == SQL_SUCCESS||retcode == SQL_SUCCESS_WITH_INFO &&
  38.    retcode1 == SQL_SUCCESS || retcode1 == SQL_SUCCESS_WITH_INFO)
  39. {
  40. retcode =SQLAllocStmt(hDBC,&hStmt);
  41. retcode = SQLPrepare(hStmt,szSqlStr, sizeof(szSqlStr));
  42. retcode = SQLExecute(hStmt);
  43. SQLBindCol(hStmt, 1,SQL_C_CHAR,szModel,sizeof(szModel),&cbModel);
  44. retcode = SQLFetch(hStmt);
  45. retcode1 =SQLAllocStmt(hDBC,&hStmt1);
  46. retcode1 = SQLPrepare(hStmt1,szSqlStr1, sizeof(szSqlStr1));
  47. retcode1 = SQLExecute(hStmt1);
  48. SQLBindCol(hStmt1, 1,SQL_C_CHAR,szModel1,sizeof(szModel1),&cbModel1);
  49. retcode1 = SQLFetch(hStmt1);
  50. retcode2 =SQLAllocStmt(hDBC,&hStmt2);
  51. retcode2 = SQLPrepare(hStmt2,szSqlStr2, sizeof(szSqlStr2));
  52. retcode2 = SQLExecute(hStmt2);
  53. SQLBindCol(hStmt2, 1,SQL_C_CHAR,szModel2,sizeof(szModel2),&cbModel2);
  54. retcode2 = SQLFetch(hStmt2);
  55. retcode3 =SQLAllocStmt(hDBC,&hStmt3);
  56. retcode3 = SQLPrepare(hStmt3,szSqlStr3, sizeof(szSqlStr3));
  57. retcode3 = SQLExecute(hStmt3);
  58. SQLBindCol(hStmt3, 1,SQL_C_CHAR,szModel3,sizeof(szModel3),&cbModel3);
  59. retcode3 = SQLFetch(hStmt3);
  60. while(retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
  61. {
  62. cout<<szModel1<<"\t\t"<<szModel<<"\t\t"<<szModel2<<"\t\t\t"
  63.      <<szModel3<<"\n";
  64. retcode = SQLFetch(hStmt);
  65. retcode1 = SQLFetch(hStmt1);
  66. retcode2 = SQLFetch(hStmt2);
  67. retcode3 = SQLFetch(hStmt3);
  68. }
  69. SQLFreeStmt(hStmt,SQL_DROP);
  70. SQLFreeStmt(hStmt1,SQL_DROP);
  71. SQLFreeStmt(hStmt2,SQL_DROP);
  72. SQLFreeStmt(hStmt3,SQL_DROP);
  73. SQLDisconnect(hDBC);
  74. }
  75. SQLFreeConnect(hDBC);
  76. SQLFreeEnv(hEnv);
  77. return 0;
  78. }
Mar 2 '07 #1
2 17141
DeMan
1,806 1GB
looks suspiciously like something the experts in the c/c++ forum might enjoy (although please add code tags (you can use the # symbol at the top of the text box you posted in))......
Some of them tend to get a bit upset when they have to read code without them
Mar 2 '07 #2
looks suspiciously like something the experts in the c/c++ forum might enjoy (although please add code tags (you can use the # symbol at the top of the text box you posted in))......
Some of them tend to get a bit upset when they have to read code without them
Hi, I need a C++ code of library management. I m not good in C++. I need to submit it in my college.
I executed the above code but all was invain. Please if anyone can shed light on my problem!!!!! Its urgent!!!
Nov 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: mark | r | last post by:
anyone know a freebie project management system that gives both admin and clients the ability to add notes with file attachments (COM less) thanks Mark
10
by: TokiDoki | last post by:
Hello there, I have been programming python for a little while, now. But as I am beginning to do more complex stuff, I am running into small organization problems. It is possible that what I...
1
by: Floris van Haaster | last post by:
Hi all, First of all: i know this is maybe not the correct newsgroup to post this but i want to get the info from real programmers and what they feel is the best. What i need is a project...
0
by: Jobs | last post by:
All answers to the below interview questions are at http://www.geocities.com/dotnetinterviews/ or you can download the complete answer zip file from...
4
by: BusEdge | last post by:
Hi all. I apologize if this has been asked/answered already, I couldn't find any info. In 1.1, my standard web application structure includes a front end website, and a management site (or...
19
by: =?iso-8859-1?q?Robin_K=E5veland?= Hansen | last post by:
Hi there. I've been learning C over the past 6 or so months, by writing small programs and reading a couple of books on the language. This means that I'm reasonable comfortable around pointers,...
3
by: larry | last post by:
I have been working on a rather large project. And I have been thinking about the structure of how I organize my project apps and libraries. It's intended as a framework type system where you can...
4
by: gardnern | last post by:
I'm trying to find a good solution for project management. In the perfect world, it would be an open-source PHP application that handles Project Management (multiple clients / multiple projects),...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.