Infolinks - Earn Easy Money

OOP Final Project

Object Oriented Programming
Final Project

Task:

       We design a Library Management System but this time using File handling Technique.

(It creates a file and store the entered data in it,
we can also extract the data from any file using same technique)

Source code:

#include <iostream>
#include <conio.h>
#include <fstream>
#include<windows.h>

using namespace std ;

int main (  ) 
{
cout << " \n\n\t\t\t|--------------------| " << endl ;
cout << " \t\t\t|                    | " << endl ;
cout << " \t\t\t|       Library      | " << endl ;
cout << " \t\t\t|      Management    | " << endl ;
cout << " \t\t\t|       System       | " << endl ;
cout << " \t\t\t|                    | " << endl ;
cout << " \t\t\t|--------------------| " << endl ;
Sleep(3000); 
system("CLS");
string *books;
      int no,B_Pages,B_Price;
      string B_Name,A_Name,B_Edition;
ofstream file ( "data.txt",ios::app) ;
{
if ( file.is_open())
 {
 

           cout << " \n\n\t\tHow many books, you wants to enter " ;
cin >> no ;
books=new string[no];
for ( int i = 0 ; i < no ; i++ )
{  
           cout<<"\n\t::Enter the Following things of book #"<<i+1<<"::"; 
cout<<"\n\n\tEnter the Serial No. of book from 1--5::";
           cin>>books[i];
           file << " \n ____________________ " ;  
           file << " \n      *** New Book ***    \n " ;
cout<<"\nEnter the Name of book::";
           cin>>B_Name;
           file << "\nBook name:" ;
           file << B_Name;
           cout<<"\nEnter the Name of Author::";
           cin>>A_Name;
           file << "\nAuthor name:" ;
           file << A_Name;
           cout<<"\nEnter the Edition of book::";
           cin>>B_Edition;
           file << "\nEdition of book:" ;
           file << B_Edition;
           cout<<"\nEnter the Pages of book::";
           cin>>B_Pages;
           file << "\nPages of book:";
           file << B_Pages;
           cout<<"\nEnter the Price of book::";
           cin>>B_Price;
           file <<"\nPrice of book:";
           file << B_Price;
          }
 }
}
 
ifstream rfile ("data.txt",ios::out ) ;
{
if ( rfile.is_open( ) )
{
while (rfile.eof())
{
string line ;
getline(rfile,line) ;
rfile >> line ;
cout << line << endl ;
}
}
}
return 0 ;
}

2 comments:

Must drop your comments about post.