This C++ program implements a library management system with functions for book and student record management. It includes classes for books and students with functions like create, read, update and delete. The main menu allows the user to issue or deposit books, access the administrator menu to manage records or exit the program. The administrator menu provides options to add, view, modify or delete book and student records stored in data files.
This document describes an object-oriented C++ program for a library management system. It defines classes for books and the library. The BookArchive class contains functions for adding, listing, modifying, deleting, searching, issuing, and returning books. The Library class inherits from BookArchive and controls the main menu functions like introduction, main menu display, and edit menu. It allows the user to perform operations like adding new books, searching for books, issuing or returning books, and modifying book details. The main function creates an object of the Library class and calls its introduction and main menu functions to start the program.
What is ES6/ES2015, and what does it mean for Javascript development? What does the new syntax look like, and how can we use it today? Featuring side-by-side comparisons!
The document provides an overview of MongoDB including key concepts like collections, documents, queries, indexes, aggregation, and more. It compares MongoDB to a traditional SQL database and shows examples of common operations like insert, update, find in MongoDB shell and Node.js driver. It also briefly covers more advanced topics like geospatial queries, optimization, replication and sharding.
This document provides an overview of 0MQ and examples of how to use it with PHP. It introduces 0MQ patterns like request/response, pub/sub, queue, and pipeline. Code snippets in PHP demonstrate implementing these patterns using 0MQ sockets. Additional resources for learning more about 0MQ and using it with PHP are provided at the end.
The document discusses parsing JSON with a single regular expression in Perl. It describes using grammars, recursion, and code execution within the regex to build a data structure that is returned. Key features include using (?&NAME) to recurse on named patterns, (?{ CODE }) to execute code during matching, and $^R to build and return a data structure.
This document provides an overview of 0MQ (also known as ZeroMQ), a messaging library that enables various messaging patterns like request/reply, publish/subscribe, and queueing. It includes code examples in multiple languages like Erlang, Python, and PHP demonstrating how to implement common 0MQ patterns. Links are also provided for additional 0MQ resources.
This document describes an object-oriented C++ program for a library management system. It defines classes for books and the library. The BookArchive class contains functions for adding, listing, modifying, deleting, searching, issuing, and returning books. The Library class inherits from BookArchive and controls the main menu functions like introduction, main menu display, and edit menu. It allows the user to perform operations like adding new books, searching for books, issuing or returning books, and modifying book details. The main function creates an object of the Library class and calls its introduction and main menu functions to start the program.
What is ES6/ES2015, and what does it mean for Javascript development? What does the new syntax look like, and how can we use it today? Featuring side-by-side comparisons!
The document provides an overview of MongoDB including key concepts like collections, documents, queries, indexes, aggregation, and more. It compares MongoDB to a traditional SQL database and shows examples of common operations like insert, update, find in MongoDB shell and Node.js driver. It also briefly covers more advanced topics like geospatial queries, optimization, replication and sharding.
This document provides an overview of 0MQ and examples of how to use it with PHP. It introduces 0MQ patterns like request/response, pub/sub, queue, and pipeline. Code snippets in PHP demonstrate implementing these patterns using 0MQ sockets. Additional resources for learning more about 0MQ and using it with PHP are provided at the end.
The document discusses parsing JSON with a single regular expression in Perl. It describes using grammars, recursion, and code execution within the regex to build a data structure that is returned. Key features include using (?&NAME) to recurse on named patterns, (?{ CODE }) to execute code during matching, and $^R to build and return a data structure.
This document provides an overview of 0MQ (also known as ZeroMQ), a messaging library that enables various messaging patterns like request/reply, publish/subscribe, and queueing. It includes code examples in multiple languages like Erlang, Python, and PHP demonstrating how to implement common 0MQ patterns. Links are also provided for additional 0MQ resources.
The document shows code for parsing and handling XML using different Perl modules. It demonstrates parsing XML strings into DOM documents using XML::LibXML and XML::Liberal, handling XML encoding such as entities and namespaces, and extracting elements and contents from the parsed DOM documents.
jQuery: out with the old, in with the newRemy Sharp
This document provides an overview and introduction to jQuery. It discusses understanding jQuery and its core functionality as a DOM library. It covers selecting elements, DOM navigation/filtering, debugging selectors, new features like deferreds/promises in jQuery's Ajax functionality. It also discusses best practices like letting the browser handle effects natively when possible, proper use of document ready, and designing well-behaved jQuery plugins.
This document summarizes Brian D Foy's presentation on "My Perl Bag of Tricks" given at YAPC::Brasil 2011. Some of the tricks discussed include eliminating special cases, using Perl to do more of the work, scaling code gracefully, parsing XML data efficiently, testing code with sample inputs/outputs, and handling errors gracefully. The presentation aims to show Perl techniques for writing cleaner, more robust code.
Perl Bag of Tricks - Baltimore Perl mongersbrian d foy
The document discusses various Perl tricks and techniques, including using regular expressions to manipulate strings, testing code with arrays of test cases, and handling errors gracefully by returning a null object.
Using Mikko Koppanen's PHP ZMQ extension we will look at how you can easily distribute work to background processes, provide flexible service brokering for your next service oriented architecture, and manage caches efficiently and easily with just PHP and the ZeroMQ libraries. Whether the problem is asynchronous communication, message distribution, process management or just about anything, ZeroMQ can help you build an architecture that is more resilient, more scalable and more flexible, without introducing unnecessary overhead or requiring a heavyweight queue manager node.
This document contains code snippets from multiple C# console application namespaces that demonstrate various C# concepts like string formatting, object methods, enums, date/time formatting, string methods, and escape sequences. The code examples show how to format output, work with objects and references, iterate over arrays and strings, parse user input, and more.
This document contains two TEI XML files: one containing the text of Ovid's Ibis poem, and the other containing critical apparatus from Owen's edition of the poem. The Ibis text contains line numbers and page breaks. The apparatus file cross-references textual variations in the poem to passages in a separate XML file containing the full text. It includes critical notes on variants found in different manuscript witnesses for several lines.
ZeroMQ Is The Answer: PHP Tek 11 VersionIan Barber
This document provides an overview of ZeroMQ (0MQ), an asynchronous messaging library. It discusses 0MQ concepts like request/response, publish/subscribe, and pipelines. It includes code examples in PHP and Python demonstrating how to implement these patterns using 0MQ sockets and messaging. Additional sections cover 0MQ transport types, installation, and integrating 0MQ with other systems like Mongrel2.
The document discusses test driven development (TDD). It covers the evolution of testing, automated testing, and the motivations and principles of TDD. The main points of TDD are covered, including writing a test first that fails, then writing code to make the test pass, and refactoring the code. An interactive session demonstrates applying TDD to developing a task list application, including tests for title, ID, completion status, and saving tasks to a database. The importance of covering variations with tests and the risks of focusing only on 100% test coverage are also discussed.
How DRY impacts JavaScript performance // Faster JavaScript execution for the...Mathias Bynens
This document discusses techniques for improving JavaScript performance by following the DRY (Don't Repeat Yourself) principle. It identifies DOM manipulation, function calls, and property lookups as particularly slow operations in JavaScript. The document provides examples of inefficient code and more optimized alternatives that avoid repetition through caching elements, using document fragments for DOM changes, and minimizing scope lookups. Overall, the document advocates structuring code in a DRY way to improve performance, especially within loops, intervals, and event handlers.
Tied variables allow the underlying implementation of scalars, arrays, hashes and filehandles to be customized by tying them to classes. This allows the normal Perl syntax and usage to remain the same while providing flexibility in how the data is stored and accessed behind the scenes. The tie interface hides this complexity from the user and makes the tied variables act like normal variables.
This document discusses modulinos, which are files that can work as both programs and modules. It provides examples of a hello.pl file that outputs "Hello World" both when run directly and when used as a module. It then shows how to add unit tests to the file and make the output customizable by passing arguments. The key aspects are running code directly or via require, adding tests, and connecting command line arguments to object initialization.
Conférence données à l'Open World Forum, 05 octobre 2013.
Comment créer une base de données noSQL par paires clés-valeurs en moins d'une heure, en se basant sur le bibliothèques Nanomsg et LightningDB.
This Perl script connects to an IRC server and channel to act as a bot. It forks multiple processes and uses these to execute system commands. The bot responds to commands from privileged users, executing commands or stopping processes. It parses IRC messages and routes commands for system execution or to send responses. Privileged users can start and stop the bot's processes through IRC commands.
Building Real Time Systems on MongoDB Using the Oplog at StripeMongoDB
The document discusses MongoDB and its oplog feature. It begins with an introduction to the oplog and how it allows data to be replicated from a primary MongoDB node to secondary nodes. It then provides examples of how the oplog can be used for real-time event processing and data transformations from MongoDB to other databases like PostgreSQL. Disaster recovery using the oplog is also discussed.
This document contains the source code for a C++ library management system project. It includes classes for books and students, along with functions for creating, modifying, deleting records, issuing and returning books. The main function displays menus for book operations, administrator options, and exits the program. The project uses file handling to read from and write to data files to store book and student records long term.
Php 102: Out with the Bad, In with the GoodJeremy Kendall
In this session, we'll look at a typical PHP application, review a few of the horrible mistakes the fictional developer made, and then refactor the app according to some best practices. Along the way you might even learn a thing or two about PHP you don't already know.
(Ab)Using the MetaCPAN API for Fun and ProfitOlaf Alders
The document discusses using the MetaCPAN API to retrieve and filter data from the MetaCPAN database. It provides examples of using the API to fetch author data for a specific author, search for authors by profile or country, and filter results. It also covers more advanced techniques like using Boolean filters, sorting results, and pagination via the scrolling API. Additional resources and tips are provided, such as caching responses and enabling compression.
This C++ program allows the user to calculate properties of 2D and 3D shapes. It includes menus to select the type of shape, whether to calculate perimeter/area/volume, and to input the necessary values. Calculations are performed for squares, circles, triangles, rhombi, cubes, rectangular prisms, cylinders, spheres. The user can repeat the calculations by selecting Y at the end.
The document shows code for parsing and handling XML using different Perl modules. It demonstrates parsing XML strings into DOM documents using XML::LibXML and XML::Liberal, handling XML encoding such as entities and namespaces, and extracting elements and contents from the parsed DOM documents.
jQuery: out with the old, in with the newRemy Sharp
This document provides an overview and introduction to jQuery. It discusses understanding jQuery and its core functionality as a DOM library. It covers selecting elements, DOM navigation/filtering, debugging selectors, new features like deferreds/promises in jQuery's Ajax functionality. It also discusses best practices like letting the browser handle effects natively when possible, proper use of document ready, and designing well-behaved jQuery plugins.
This document summarizes Brian D Foy's presentation on "My Perl Bag of Tricks" given at YAPC::Brasil 2011. Some of the tricks discussed include eliminating special cases, using Perl to do more of the work, scaling code gracefully, parsing XML data efficiently, testing code with sample inputs/outputs, and handling errors gracefully. The presentation aims to show Perl techniques for writing cleaner, more robust code.
Perl Bag of Tricks - Baltimore Perl mongersbrian d foy
The document discusses various Perl tricks and techniques, including using regular expressions to manipulate strings, testing code with arrays of test cases, and handling errors gracefully by returning a null object.
Using Mikko Koppanen's PHP ZMQ extension we will look at how you can easily distribute work to background processes, provide flexible service brokering for your next service oriented architecture, and manage caches efficiently and easily with just PHP and the ZeroMQ libraries. Whether the problem is asynchronous communication, message distribution, process management or just about anything, ZeroMQ can help you build an architecture that is more resilient, more scalable and more flexible, without introducing unnecessary overhead or requiring a heavyweight queue manager node.
This document contains code snippets from multiple C# console application namespaces that demonstrate various C# concepts like string formatting, object methods, enums, date/time formatting, string methods, and escape sequences. The code examples show how to format output, work with objects and references, iterate over arrays and strings, parse user input, and more.
This document contains two TEI XML files: one containing the text of Ovid's Ibis poem, and the other containing critical apparatus from Owen's edition of the poem. The Ibis text contains line numbers and page breaks. The apparatus file cross-references textual variations in the poem to passages in a separate XML file containing the full text. It includes critical notes on variants found in different manuscript witnesses for several lines.
ZeroMQ Is The Answer: PHP Tek 11 VersionIan Barber
This document provides an overview of ZeroMQ (0MQ), an asynchronous messaging library. It discusses 0MQ concepts like request/response, publish/subscribe, and pipelines. It includes code examples in PHP and Python demonstrating how to implement these patterns using 0MQ sockets and messaging. Additional sections cover 0MQ transport types, installation, and integrating 0MQ with other systems like Mongrel2.
The document discusses test driven development (TDD). It covers the evolution of testing, automated testing, and the motivations and principles of TDD. The main points of TDD are covered, including writing a test first that fails, then writing code to make the test pass, and refactoring the code. An interactive session demonstrates applying TDD to developing a task list application, including tests for title, ID, completion status, and saving tasks to a database. The importance of covering variations with tests and the risks of focusing only on 100% test coverage are also discussed.
How DRY impacts JavaScript performance // Faster JavaScript execution for the...Mathias Bynens
This document discusses techniques for improving JavaScript performance by following the DRY (Don't Repeat Yourself) principle. It identifies DOM manipulation, function calls, and property lookups as particularly slow operations in JavaScript. The document provides examples of inefficient code and more optimized alternatives that avoid repetition through caching elements, using document fragments for DOM changes, and minimizing scope lookups. Overall, the document advocates structuring code in a DRY way to improve performance, especially within loops, intervals, and event handlers.
Tied variables allow the underlying implementation of scalars, arrays, hashes and filehandles to be customized by tying them to classes. This allows the normal Perl syntax and usage to remain the same while providing flexibility in how the data is stored and accessed behind the scenes. The tie interface hides this complexity from the user and makes the tied variables act like normal variables.
This document discusses modulinos, which are files that can work as both programs and modules. It provides examples of a hello.pl file that outputs "Hello World" both when run directly and when used as a module. It then shows how to add unit tests to the file and make the output customizable by passing arguments. The key aspects are running code directly or via require, adding tests, and connecting command line arguments to object initialization.
Conférence données à l'Open World Forum, 05 octobre 2013.
Comment créer une base de données noSQL par paires clés-valeurs en moins d'une heure, en se basant sur le bibliothèques Nanomsg et LightningDB.
This Perl script connects to an IRC server and channel to act as a bot. It forks multiple processes and uses these to execute system commands. The bot responds to commands from privileged users, executing commands or stopping processes. It parses IRC messages and routes commands for system execution or to send responses. Privileged users can start and stop the bot's processes through IRC commands.
Building Real Time Systems on MongoDB Using the Oplog at StripeMongoDB
The document discusses MongoDB and its oplog feature. It begins with an introduction to the oplog and how it allows data to be replicated from a primary MongoDB node to secondary nodes. It then provides examples of how the oplog can be used for real-time event processing and data transformations from MongoDB to other databases like PostgreSQL. Disaster recovery using the oplog is also discussed.
This document contains the source code for a C++ library management system project. It includes classes for books and students, along with functions for creating, modifying, deleting records, issuing and returning books. The main function displays menus for book operations, administrator options, and exits the program. The project uses file handling to read from and write to data files to store book and student records long term.
Php 102: Out with the Bad, In with the GoodJeremy Kendall
In this session, we'll look at a typical PHP application, review a few of the horrible mistakes the fictional developer made, and then refactor the app according to some best practices. Along the way you might even learn a thing or two about PHP you don't already know.
(Ab)Using the MetaCPAN API for Fun and ProfitOlaf Alders
The document discusses using the MetaCPAN API to retrieve and filter data from the MetaCPAN database. It provides examples of using the API to fetch author data for a specific author, search for authors by profile or country, and filter results. It also covers more advanced techniques like using Boolean filters, sorting results, and pagination via the scrolling API. Additional resources and tips are provided, such as caching responses and enabling compression.
This C++ program allows the user to calculate properties of 2D and 3D shapes. It includes menus to select the type of shape, whether to calculate perimeter/area/volume, and to input the necessary values. Calculations are performed for squares, circles, triangles, rhombi, cubes, rectangular prisms, cylinders, spheres. The user can repeat the calculations by selecting Y at the end.
This document is a project file for a bookshop management system created by two students. It includes:
1. An acknowledgements section thanking those who helped with the project.
2. A coding section that outlines the C++ code used to create classes for subjects, books, users, and a main function to run the program.
3. Information on the header files used for file handling, input/output, and other functions.
In 3 sentences it summarizes the purpose of the document, that it was created by two students for a bookshop project, and outlines some of the key sections of code and classes included.
C project on a bookshop for saving of coustmer recordZaibi Gondal
This C program code implements a bookshop management system that allows users to record customer and book purchase details, and search/display records by date, customer name, mobile number, or book name. The code defines functions for writing new records to a text file, displaying stored records by searching on different fields, and closing the program. It uses a main menu driven loop to call these functions and manage user input/output through the runtime.
The document contains code snippets from various CGI/PHP programs. The programs demonstrate concepts like:
- Printing HTTP headers and HTML tags to display web pages
- Retrieving and displaying environment variables and form parameters
- Performing SQL queries to insert, update, select from databases
- Using sessions and cookies to store and retrieve user information across requests
The programs cover basic to intermediate level skills for server-side scripting with CGI/PHP.
If your not using an ORM (object relational mapper) and are still writing SQL by hand, here's what you need to know.
An introduction into DBIx::Class and some of the concepts and goodies you should be aware off.
Goro Fuji presented on the Xslate template engine. Xslate is heavily inspired by Template Toolkit and Text::MicroTemplate. It aims to be 100+ times faster than Template Toolkit with smart escaping of HTML to prevent XSS vulnerabilities, similar to Text::MicroTemplate. The presentation covered how to install and use Xslate from Perl, supported features like variables, loops, includes, and utilities.
This document provides an introduction and overview of DBIx::Class, an ORM (object relational mapper) for Perl. It discusses setting up tables for an authors and books example database, and performing CRUD (create, read, update, delete) operations both manually using SQL and using DBIx::Class. It also covers creating models with Schema::Loader, debugging, overloading result and result set classes, and inflating/deflating columns.
The document shows examples of using switch statements in Groovy with different data types and cases. It demonstrates matching strings, regular expressions, ranges, collections, objects, null values, and using a closure as a case.
Computer Science investigatory project class 12Raunak Yadav
This document is a computer science project on a bookshop management system created by Raunak Yadav. It includes an index, acknowledgements, coding in C++ to create classes for subjects, users, and user lists. It also includes functions for creating and opening user accounts, viewing book lists, purchasing and returning books. The output shows the interface for these main functions of the bookshop management system.
This document contains code for a console bookstore application backend. It includes functions for displaying menus, purchasing books, reserving books, and validating user input. The main function initializes variables and displays an intro screen before running a loop to get user input and call the appropriate function for that selection, such as purchasing a book which would validate inputs, calculate totals, and display a receipt. Other functions validate dates, calculate taxes, and clear the console screen between menus.
This document summarizes the history of PHP persistence from 1995 to present day. It begins with early file handling in PHP/FI in 1995 and the introduction of database support. It then discusses the evolution of code reusability through functions and classes. Professional abstraction layers like PEAR and later ORM frameworks provided more robust and standardized APIs. NoSQL databases and drivers were later incorporated, moving beyond relational databases. Current frameworks provide object document mapping for non-SQL databases like MongoDB.
The document summarizes a Perl Mongers course on data and operators in Perl. It covers basic data types like scalars, arrays, and hashes. It describes strings, numbers, and how to perform operations on them. It also discusses control structures like conditionals and loops for program flow. Finally, it mentions input/output functions like STDIN and STDOUT.
Conheça um pouco mais sobre Perl 6, uma linguagem de programação moderna, poderosa e robusta que permitirá que você escreva código de forma ágil e eficiente.
This document discusses the evolution of C# and .NET Framework over time. It lists various C# versions and their associated .NET Framework versions and Visual Studio versions. It also provides examples of new C# language features such as tuples, nullable reference types, default interface methods, and extension methods.
Introduction- e - waste – definition - sources of e-waste– hazardous substances in e-waste - effects of e-waste on environment and human health- need for e-waste management– e-waste handling rules - waste minimization techniques for managing e-waste – recycling of e-waste - disposal treatment methods of e- waste – mechanism of extraction of precious metal from leaching solution-global Scenario of E-waste – E-waste in India- case studies.
HEAP SORT ILLUSTRATED WITH HEAPIFY, BUILD HEAP FOR DYNAMIC ARRAYS.
Heap sort is a comparison-based sorting technique based on Binary Heap data structure. It is similar to the selection sort where we first find the minimum element and place the minimum element at the beginning. Repeat the same process for the remaining elements.
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesChristina Lin
Traditionally, dealing with real-time data pipelines has involved significant overhead, even for straightforward tasks like data transformation or masking. However, in this talk, we’ll venture into the dynamic realm of WebAssembly (WASM) and discover how it can revolutionize the creation of stateless streaming pipelines within a Kafka (Redpanda) broker. These pipelines are adept at managing low-latency, high-data-volume scenarios.
A review on techniques and modelling methodologies used for checking electrom...nooriasukmaningtyas
The proper function of the integrated circuit (IC) in an inhibiting electromagnetic environment has always been a serious concern throughout the decades of revolution in the world of electronics, from disjunct devices to today’s integrated circuit technology, where billions of transistors are combined on a single chip. The automotive industry and smart vehicles in particular, are confronting design issues such as being prone to electromagnetic interference (EMI). Electronic control devices calculate incorrect outputs because of EMI and sensors give misleading values which can prove fatal in case of automotives. In this paper, the authors have non exhaustively tried to review research work concerned with the investigation of EMI in ICs and prediction of this EMI using various modelling methodologies and measurement setups.
Understanding Inductive Bias in Machine LearningSUTEJAS
This presentation explores the concept of inductive bias in machine learning. It explains how algorithms come with built-in assumptions and preferences that guide the learning process. You'll learn about the different types of inductive bias and how they can impact the performance and generalizability of machine learning models.
The presentation also covers the positive and negative aspects of inductive bias, along with strategies for mitigating potential drawbacks. We'll explore examples of how bias manifests in algorithms like neural networks and decision trees.
By understanding inductive bias, you can gain valuable insights into how machine learning models work and make informed decisions when building and deploying them.
We have compiled the most important slides from each speaker's presentation. This year’s compilation, available for free, captures the key insights and contributions shared during the DfMAy 2024 conference.
1. #include<fstream>
#include<cstring>
#include<iomanip>
#include<iostream>
using namespace std;
class book
{
char bno[6];
char bname[50];
char aname[20];
public:
void create_book()
{
cout<<"nNEW BOOK ENTRY...n";
cout<<"nEnter The book no.";
cin>>bno;
cout<<"nnEnter The Name of The Book ";
cin>>bname;
cout<<"nnEnter The Author's Name ";
cin>>aname;
cout<<"nnnBook Created..";
}
void show_book()
{
cout<<"nBook no. : "<<bno;
cout<<"nBook Name : ";
puts(bname);
cout<<"Author Name : ";
puts(aname);
}
void modify_book()
{
cout<<"nBook no. : "<<bno;
cout<<"nModify Book Name : ";
cin>>bname;
cout<<"nModify Author's Name of Book : ";
cin>>aname;
}
char* retbno()
{
return bno;
}
void report()
{cout<<bno<<setw(30)<<bname<<setw(30)<<aname<<endl;}
};
class student
{
char admno[6];
char name[20];
char stbno[6];
int token;
public:
void create_student()
{
cout<<"nNEW STUDENT ENTRY...n";
cout<<"nEnter The admission no. ";
cin>>admno;
2. cout<<"nnEnter The Name of The Student ";
cin>>name;
token=0;
stbno[0]='0';
cout<<"nnStudent Record Created..";
}
void show_student()
{
cout<<"ntAdmission no. : "<<admno;
cout<<"ntStudent Name : ";
puts(name);
cout<<"ntNo of Book issued : "<<token;
if(token==1)
cout<<"ntBook No "<<stbno;
}
void modify_student()
{
cout<<"nAdmission no. : "<<admno;
cout<<"nModify Student Name : ";
cin>>name;
}
char* retadmno()
{
return admno;
}
char* retstbno()
{
return stbno;
}
int rettoken()
{
return token;
}
void addtoken()
{token=1;}
void resettoken()
{token=0;}
void getstbno(char t[])
{
strcpy(stbno,t);
}
void report()
{cout<<"t"<<admno<<setw(20)<<name<<setw(10)<<token<<endl;}
};
fstream fp,fp1;
book bk;
student st;
void write_book()
{
char ch;
fp.open("book.dat",ios::out|ios::app);
do
3. {
bk.create_book();
fp.write((char*)&bk,sizeof(book));
cout<<"nntDo you want to add more record..(y/n?)";
cin>>ch;
}while(ch=='y'||ch=='Y');
fp.close();
}
void write_student()
{
char ch;
fp.open("student.dat",ios::out|ios::app);
do
{
st.create_student();
fp.write((char*)&st,sizeof(student));
cout<<"nntDo you want to add more record..(y/n?)";
cin>>ch;
}while(ch=='y'||ch=='Y');
fp.close();
}
void display_spb(char n[])
{
cout<<"ntBOOK DETAILSn";
int flag=0;
fp.open("book.dat",ios::in);
while(fp.read((char*)&bk,sizeof(book)))
{
if(strcmpi(bk.retbno(),n)==0)
{
bk.show_book();
flag=1;
}
}
fp.close();
if(flag==0)
cout<<"nntBook does not exist";
return;
}
void display_sps(char n[])
{
cout<<"ntSTUDENT DETAILSn";
int flag=0;
fp.open("student.dat",ios::in);
while(fp.read((char*)&st,sizeof(student)))
{
if((strcmpi(st.retadmno(),n)==0))
{
st.show_student();
flag=1;
}
}
fp.close();
if(flag==0)
cout<<"nnStudent does not exist";
return;
}
4. void modify_book()
{
char n[6];
int found=0;
cout<<"nntMODIFY BOOK RECORD.... ";
cout<<"nntEnter The book no. of The book";
cin>>n;
fp.open("book.dat",ios::in|ios::out);
while(fp.read((char*)&bk,sizeof(book)) && found==0)
{
if(strcmpi(bk.retbno(),n)==0)
{
bk.show_book();
cout<<"nEnter The New Details of book"<<endl;
bk.modify_book();
int pos=-1*sizeof(bk);
fp.seekp(pos,ios::cur);
fp.write((char*)&bk,sizeof(book));
cout<<"nnt Record Updated";
found=1;
}
}
fp.close();
if(found==0)
cout<<"nn Record Not Found ";
return;
}
void modify_student()
{
char n[6];
int found=0;
cout<<"nntMODIFY STUDENT RECORD... ";
cout<<"nntEnter The admission no. of The student";
cin>>n;
fp.open("student.dat",ios::in|ios::out);
while(fp.read((char*)&st,sizeof(student)) && found==0)
{
if(strcmpi(st.retadmno(),n)==0)
{
st.show_student();
cout<<"nEnter The New Details of student"<<endl;
st.modify_student();
int pos=-1*sizeof(st);
fp.seekp(pos,ios::cur);
fp.write((char*)&st,sizeof(student));
cout<<"nnt Record Updated";
found=1;
}
}
fp.close();
if(found==0)
cout<<"nn Record Not Found ";
return;
}
void delete_student()
{
char n[6];
int flag=0;
5. cout<<"nnntDELETE STUDENT...";
cout<<"nnEnter The admission no. of the Student You Want To Delete : ";
cin>>n;
fp.open("student.dat",ios::in|ios::out);
fstream fp2;
fp2.open("Temp.dat",ios::out);
fp.seekg(0,ios::beg);
while(fp.read((char*)&st,sizeof(student)))
{
if(strcmpi(st.retadmno(),n)!=0)
fp2.write((char*)&st,sizeof(student));
else
flag=1;
}
fp2.close();
fp.close();
remove("student.dat");
rename("Temp.dat","student.dat");
if(flag==1)
cout<<"nntRecord Deleted ..";
else
cout<<"nntRecord not found";
return;
}
void delete_book()
{
char n[6];
cout<<"nnntDELETE BOOK ...";
cout<<"nntEnter The Book no. of the Book You Want To Delete : ";
cin>>n;
fp.open("book.dat",ios::in|ios::out);
fstream fp2;
fp2.open("Temp.dat",ios::out);
fp.seekg(0,ios::beg);
while(fp.read((char*)&bk,sizeof(book)))
{
if(strcmpi(bk.retbno(),n)!=0)
{
fp2.write((char*)&bk,sizeof(book));
}
}
fp2.close();
fp.close();
remove("book.dat");
rename("Temp.dat","book.dat");
cout<<"nntRecord Deleted ..";
return;
}
void display_alls()
{
fp.open("student.dat",ios::in);
if(!fp)
{
cout<<"tERROR!!! FILE COULD NOT BE OPEN ";
return;
}
cout<<"nnttSTUDENT LISTnn";
7. int pos=-1*sizeof(st);
fp.seekp(pos,ios::cur);
fp.write((char*)&st,sizeof(student));
cout<<"nnt Book issued
successfullynnPlease Note: Write the current date in backside of your book and
submit it within 15 days. Fine Rs. 1 for each day after 15 days period";
}
}
if(flag==0)
cout<<"tBook no does not exist";
}
else
cout<<"t!!!!You have not returned the last book!!!! ";
}
}
if(found==0)
cout<<"tStudent record not exist...";
return;
fp.close();
fp1.close();
}
void book_deposit()
{
char sn[6],bn[6];
int found=0,flag=0,day,fine;
cout<<"nntBOOK DEPOSIT ...";
cout<<"nntEnter The student’s admission no.";
cin>>sn;
fp.open("student.dat",ios::in|ios::out);
fp1.open("book.dat",ios::in|ios::out);
while(fp.read((char*)&st,sizeof(student)) && !found)
{
if(!strcmpi(st.retadmno(),sn))
{
found=1;
if(st.rettoken()==1)
{
while(fp1.read((char*)&bk,sizeof(book))&& !flag)
{
if(strcmpi(bk.retbno(),st.retstbno())==0)
{
bk.show_book();
flag=1;
cout<<"nnBook deposited in no. of days";
cin>>day;
if(day>15)
{
fine=(day-15)*1;
cout<<"nnFine has to deposited Rs.
"<<fine;
}
st.resettoken();
int pos=-1*sizeof(st);
fp.seekp(pos,ios::cur);
fp.write((char*)&st,sizeof(student));
cout<<"nnt Book deposited successfully";
}
}
if(!flag)
cout<<"tBook no does not exist";
}
else
8. cout<<"tNo book is issued..please check!!";
}
}
if(!found)
cout<<"tStudent record not exist...";
return;
fp.close();
fp1.close();
}
void intro(){
for(int i=0;i<192;i++){
cout<<"*";
}
cout<<"tMADE BY:- tttROLL NO:-n";
cout<<"tHIMANSHU GARGttt1130272n";
cout<<"tNAMAN MAHESHWARI tt1130275n";
cout<<"tBHUWAN ABROLttt1130281n";
for(int i=0;i<192;i++){
cout<<"*";
}
cout<<"nttttttPRESENTS";
cout<<"nnttt t*******************************n";
cout<<"ttttt** LIBRARY MANAGEMENT SYSTEM **";
cout<<"nttt t*******************************n";
for(int i=0;i<192;i++){
cout<<"*";
}
return;
}
void admin_menu()
{
int ch2;
cout<<"nnntADMINISTRATOR MENU";
cout<<"nnt1.CREATE STUDENT RECORD";
cout<<"nnt2.DISPLAY ALL STUDENTS RECORD";
cout<<"nnt3.DISPLAY SPECIFIC STUDENT RECORD ";
cout<<"nnt4.MODIFY STUDENT RECORD";
cout<<"nnt5.DELETE STUDENT RECORD";
cout<<"nnt6.CREATE BOOK ";
cout<<"nnt7.DISPLAY ALL BOOKS ";
cout<<"nnt8.DISPLAY SPECIFIC BOOK ";
cout<<"nnt9.MODIFY BOOK ";
cout<<"nnt10.DELETE BOOK ";
cout<<"nnt11.BACK TO MAIN MENU";
cout<<"nntPlease Enter Your Choice (1-11) ";
cin>>ch2;
switch(ch2)
{
case 1: write_student();
break;
case 2: display_alls();
break;
case 3: char num[6];
cout<<"nntPlease Enter The Admission No. ";
cin>>num;
display_sps(num);
break;
case 4: modify_student();
break;
case 5: delete_student();
break;
case 6: write_book();
9. break;
case 7: display_allb();
break;
case 8: {
char num[6];
cout<<"nntPlease Enter The book No. ";
cin>>num;
display_spb(num);
break;
}
case 9: modify_book();
break;
case 10: delete_book();
break;
case 11: return;
default:cout<<"a";
}
admin_menu();
}
int main()
{
char ch;
intro();
do{
cout<<"nnntMAIN MENU";
cout<<"nnt01. BOOK ISSUE";
cout<<"nnt02. BOOK DEPOSIT";
cout<<"nnt03. ADMINISTRATOR MENU";
cout<<"nnt04. EXIT";
cout<<"nntPlease Select Your Option (1-4) ";
cin>>ch;
switch(ch)
{
case '1': book_issue();
break;
case '2': book_deposit();
break;
case '3': admin_menu();
break;
case '4': exit(0);
default :cout<<"a";
}
}while(ch!='4');
return 0;
}
10. break;
case 7: display_allb();
break;
case 8: {
char num[6];
cout<<"nntPlease Enter The book No. ";
cin>>num;
display_spb(num);
break;
}
case 9: modify_book();
break;
case 10: delete_book();
break;
case 11: return;
default:cout<<"a";
}
admin_menu();
}
int main()
{
char ch;
intro();
do{
cout<<"nnntMAIN MENU";
cout<<"nnt01. BOOK ISSUE";
cout<<"nnt02. BOOK DEPOSIT";
cout<<"nnt03. ADMINISTRATOR MENU";
cout<<"nnt04. EXIT";
cout<<"nntPlease Select Your Option (1-4) ";
cin>>ch;
switch(ch)
{
case '1': book_issue();
break;
case '2': book_deposit();
break;
case '3': admin_menu();
break;
case '4': exit(0);
default :cout<<"a";
}
}while(ch!='4');
return 0;
}