/////////////////////////////////////////////////////////////////////////////
//**************** R E N T A C A R D A T A B A S E ********************//
/////////////////////////////////////////////////////////////////////////////
//////// Consists of all features that are found in a database system////////
///Have features of adding, deleteing, searching and viewing records above///
///all one can edit records too. Report is generated through totalling the///
/////expenses and incomes and been showed in the form of a balance sheet/////
/////////////////////////////////////////////////////////////////////////////
#include <iostream.h>
#include <fstream.h> // Header..
#include <conio.h>
#include <process.h> // ..files..
#include <graphics.h>
#include <string.h> // ..inclusion
#include <dos.h>
#include <iomanip.h>
#include <math.h>
#include <stdio.h>
#include <time.h>
//////////////////////////////// CAR CLASS ///////////////////////////////////
class Car
{
private:
char Name [30]; // Variables..
char Color [20]; // ..Initialization
char Model [6];
char Type [15];
char Rent [6];
char Status [15];
public:
Car* Next;
Car ()
{ Next=NULL; }
// To get information about Vehicle
void GetInfo ( Car* current )
{
gotoxy ( 5, 2 );cout << " VEHICLE'S INFO ";
setcolor (4);
rectangle ( 300, 60, 555, 85 );
gotoxy ( 10,5); cout << " Enter the NAME of Vehicle : ";
rectangle ( 300, 90, 485, 115 );
gotoxy ( 10,7); cout << " COLOR of the Vehicle : ";
rectangle ( 300, 123, 350, 148 );
gotoxy ( 10,9); cout << " MODEL NUMBER of Vehicle : ";
rectangle ( 300, 156, 425, 181 );
gotoxy ( 10,11);cout << " TYPE of Vehicle : ";
rectangle ( 300, 188, 350, 213 );
gotoxy ( 10,13);cout << " RENT of Vehicle (/d) : ";
rectangle ( 300, 221, 465, 246 );
gotoxy ( 10,15);cout << " STATUS of Vehicle : ";
// Enter Informations
gotoxy ( 40,5);cin.getline ( current->Name, 30 );
gotoxy ( 40,7);cin.getline ( current->Color, 20 );
gotoxy ( 40,9);cin.getline ( current->Model, 6 ) ;
gotoxy ( 40,11);cin.getline ( current->Type, 15 );
gotoxy ( 40,13);cin.getline ( current->Rent, 6 );
gotoxy ( 40,15);cin.getline ( current->Status, 15 );
}
// To set the link to make the link list
void Setlink ( Car* current, Car* previous )
{ previous->Next = current; }
// Saving to the file Car.txt
void Saving_To_File ( Car* Curr )
{
ofstream ouf ( "Car.txt",ios::app ); // open file with append mode
ouf << endl // Adding all..
<< Curr->Name << endl << Curr->Color << endl // ..items to..
<< Curr->Model << endl << Curr->Type << endl // ..file
<< Curr->Rent << endl << Curr->Status;
ouf.close (); // File close
}
// Draws borders around the screen
void DisplayScreen ()
{
int x0 = 0, y0 = 0; // Co-ordinates
int x5 = 5, y5 = 5; // Initialization
int xend = 639, yend = 479;
line ( x0, y0, xend, y0 ); // Outer..
line ( xend, y0, xend, yend ); // ..Border
line ( x0, yend, xend, yend );
line ( x0, y0, x0, yend );
line ( x5, y5, xend-5, y5 );
line ( xend-5, y5, xend-5, yend-5 ); // Inner..
line ( x5, yend-5, xend-5, yend-5 ); // ..Border
line ( x5, y5, x5, yend-5 );
}
};
//////////////////////////// CARS LIST //////////////////////////////////////
class CarList : public Car
{
private:
Car* Head;
Car* Current;
Car* Previous;
public:
CarList ()
{ Head = NULL; }
// All the functions in CarList
void AddCar ();
void Display ();
void SearchName ( char[] );
void SearchColor ( char[] );
void DeleteAll ();
void DeleteSpecific ( char[] );
void Edit ( char[] );
};
// Adds a new Vehicle and forms a linked list
void CarList::AddCar ()
{
Current = new Car;
Car :: GetInfo ( Current ); // Gets information about the Vehicle
if ( Head == NULL ) // If first node is NULL
Head = Current;
else // If there is more than one node
{
Previous = Head;
while ( Previous->Next != NULL )
Previous = Previous->Next;
Setlink ( Current, Previous ); // Links are set
}
Previous = Current;
Saving_To_File ( Current ); // Current is saved to file
}
//********* Add a new Vehicle to list *********\\
void CarList::Display ()
{
int count = 0; // keeps a count of how many records are present
char name[30]; char color[20]; char model[6]; // Variables..
char type[15]; char rent[6]; char status[15]; // ..Initialization
ifstream inf ( "Car.txt" ); // Opens the file
inf.ignore ( 80, '\n' ); // Ignores first line
while ( inf.good () )
{
count++; // Increases the count
inf.getline ( name, 30 ); inf.getline ( color, 20 ); // Read data..
inf.getline ( model, 6 ); inf.getline ( type, 15 );
inf.getline ( rent, 6 ); inf.getline ( status, 15 ); // ..from file
cout << endl << "NAME ====>> " << name << endl; // Displays..
cout << "COLOR ===>> " << color << endl; // ..data..
cout << "MODEL ===>> " << model << endl; //..on..
cout << "TYPE ====>> " << type << endl; // ..screen
cout << "RENT ====>> " << rent << endl;
cout << "STATUS ==>> " << status << endl << endl;
getche ();
}
cout << endl << "There are " << count << " records";// Shows no of records
inf.close(); // File closed
}
//************** To Search by name of Car ****************\\
void CarList::SearchName ( char num [30] )
{
Car :: DisplayScreen();
int sucess=0;
int col = 22;
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
char name[30]; char color[20]; char model[6]; // Variables..
char type[15]; char rent[6]; char status[15]; // ..Initialization
ifstream infile ( "Car.txt" ); // Opens file
infile.seekg(0);
infile.ignore ( 80, '\n' );
while ( !infile.eof () ) // Search till the end of file
{
infile.getline ( name, 30 ); infile.getline ( color, 20 );// Read data..
infile.getline ( model, 6 ); infile.getline ( type, 15 );
infile.getline ( rent, 6 ); infile.getline ( status, 15 );// ..from File
if ( strcmp ( num, name ) == 0 ) // Compares the two strings
{
sucess=1;
cleardevice (); // Clearscreen
Car::DisplayScreen();
gotoxy ( 5, 5 );cout << "Record Found!! "<< endl;
gotoxy ( 5, 6 );cout << "Press any key to display......." << endl << endl;
getche ();
gotoxy ( 20, 12 );cout << "NAME ==>> " << name; // Displays..
gotoxy ( 20, 13 );cout << "COLOR==>> " << color;
gotoxy ( 20, 14 );cout << "MODEL==>> " << model; // ..the..
gotoxy ( 20, 15 );cout << "TYPE==>>> " << type;
gotoxy ( 20, 16 );cout << "RENT===>> " << rent; // ..record.
gotoxy ( 20, 17 );cout << "STATUS=>> " << status;
getche ();
}
}
if ( sucess==0 ) // If search not found
{ gotoxy ( 28,14 ); cout << "Record not Found !!! " << endl; }
getche ();
infile.close (); // Close file
}
//*************** To Search by Color of Car ***************\\
void CarList::SearchColor ( char num [10] )
{
Car :: DisplayScreen();
int sucess=0;
int col = 22;
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
char name[30]; char color[20]; char model[6]; // Variables..
char type[15]; char rent[6]; char status[15]; // ..Initialization
ifstream infile ( "Car.txt" ); // Opens the file
infile.seekg(0);
infile.ignore ( 80, '\n' ); // ignore one line
while ( !infile.eof () ) // Search till the end of file
{
infile.getline ( name, 30 ); infile.getline ( color, 20 ); //Read data..
infile.getline ( model, 6 ); infile.getline ( type, 15 ); // ..from..
infile.getline ( rent, 6 ); infile.getline ( status, 15 ); // ..file
if ( strcmp ( num, color ) == 0 ) // Compares both the strings
{
sucess=1;
cleardevice (); // Clearscreen
Car::DisplayScreen();
gotoxy ( 5, 5 );cout << "Record Found!! "<< endl;
gotoxy ( 5, 6 );cout << "Press any key to display......." << endl << endl;
getche ();
gotoxy ( 20, 12 );cout << "NAME ==>> " << name; // Displays..
gotoxy ( 20, 13 );cout << "COLOR==>> " << color;
gotoxy ( 20, 14 );cout << "MODEL==>> " << model; // ..the searched
gotoxy ( 20, 15 );cout << "TYPE===>> " << type;
gotoxy ( 20, 16 );cout << "RENT===>> " << rent;
gotoxy ( 20, 16 );cout << "STATUS=>> " << status; // ..record
getche ();
}
}
if ( sucess==0 ) // If search not found
{ gotoxy ( 28,14 ); cout << "Record not Found !!! " << endl; }
getche ();
infile.close (); // Close file
}
//******* Deletes an existing record from file ********//
void CarList::DeleteSpecific ( char num [30] )
{
Car :: DisplayScreen();
int count=0; int sucess=0; int suc=0; int col = 22; // Variables..
char name[30]; char color[20]; char model[6];
char type[15]; char rent[6]; char status[15]; // ..Initialization
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
ifstream infile ( "Car.txt" );
infile.seekg(0);
infile.ignore ( 80, '\n' );
while ( !infile.eof () ) // Search till the end of file
{
infile.getline ( name, 30 ); infile.getline ( color, 20 ); //Read data..
infile.getline ( model, 6 ); infile.getline ( type, 15 ); // ..from..
infile.getline ( rent, 6 ); infile.getline ( status, 15 ); // ..file
count++; // Increase count
if ( strcmp ( num, name ) == 0 ) // Compares the two strings
{
sucess=1; // If record found
cleardevice (); // Clears the screen
Car::DisplayScreen();
gotoxy ( 5, 5 );cout << "Record Found!! "<< endl;
gotoxy ( 5, 6 );cout << "Press any key to display......." << endl << endl;
getche ();
gotoxy ( 20, 12 );cout << "NAME ==>> " << name; // display
gotoxy ( 20, 13 );cout << "COLOR==>> " << color;
gotoxy ( 20, 14 );cout << "MODEL==>> " << model; // the data
gotoxy ( 20, 15 );cout << "TYPE==>>> " << type;
gotoxy ( 20, 16 );cout << "RENT===>> " << rent; // on screen
gotoxy ( 20, 17 );cout << "STATUS=>> " << status;
gotoxy ( 20, 18 );cout << " Do you want to DELETE this record (y/n)?? ";
char ChoiceToDel;
ChoiceToDel = getche();
switch ( ChoiceToDel )
{
case 'y' : // If want to delete
suc=1;
break;
case 'n' : // If not then break and search the file for more
break;
}
if ( suc==1 ) // if to delete, break and make preparations to delete
break;
}
}
if ( (sucess==1) && (suc==1) )
{
ofstream ouf ( "TempCar.txt",ios::app ); // create an temporary file
ifstream infile ( "Car.txt" );
infile.seekg(0);
infile.ignore ( 80, '\n' );
for ( int d = 1; d<=count-1; d++ ) // get the data which is before..
{ // ..the data to be deleted..
infile.getline ( name, 30 ); infile.getline ( color, 20 );
infile.getline ( model, 6 ); infile.getline ( type, 15 );
infile.getline ( rent, 6 ); infile.getline ( status, 15 );
ouf << endl
<< name << endl << color << endl //..and copy it to the temporary
<< model << endl << type << endl // ..creted file
<< rent << endl << status;
}
// Skip the record that is to be deleted
infile.getline ( name, 30 ); infile.getline ( color, 20 );
infile.getline ( model, 6 ); infile.getline ( type, 15 );
infile.getline ( rent, 6 ); infile.getline ( status, 15 );
while ( !infile.eof () ) // Again continue reading till the end of file
{ // Get the rest of the records..
infile.getline ( name, 30 ); infile.getline ( color, 20 );
infile.getline ( model, 6 ); infile.getline ( type, 15 );
infile.getline ( rent, 6 ); infile.getline ( status, 15 );
ouf << endl // .. and copy it to the temporary file
<< name << endl << color << endl
<< model << endl << type << endl
<< rent << endl << status;
}
infile.close(); // Close both..
ouf.close(); // ..the files
CarList::DeleteAll (); // Deletes all the data from the original file
ofstream oufc ( "Car.txt", ios::app ); // Opens the same file
ifstream inf ( "TempCar.txt" );//Prepares to read data from the temporary file
inf.seekg(0);
inf.ignore ( 80, '\n' );
while ( inf.good () )
{ // Get the data from the temporary file..
inf.getline ( name, 30 ); inf.getline ( color, 20 );
inf.getline ( model, 6 ); inf.getline ( type, 15 );
inf.getline ( rent, 6 ); inf.getline ( status, 15 );
oufc << endl // ..and copy it again to the original file
<< name << endl << color << endl
<< model << endl << type << endl
<< rent << endl << status;
}
}
if ( sucess==0 ) // If search does not match
{ gotoxy ( 28,14 ); cout << "Record not Found !!! "<< endl; }
getche ();
infile.close (); // Close the file
ofstream ouft;
ouft.open ( "TempCar.txt", ios::trunc ); // Cleares the temporary..
ouft.close(); // ..created file
}
//********* Can edit an existing record **********\\
void CarList::Edit ( char num [30] )
{
Car :: DisplayScreen();
char name[30]; char color[20]; char model[6]; // Variables..
char type[15]; char rent[6]; char status[15]; // ..Initialization
char newstatus[25];
int count=0; int sucess=0; int col = 22; int suc=0;
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
ifstream infile ( "Car.txt" );
infile.seekg(0);
infile.ignore ( 80, '\n' );
while ( !infile.eof () ) // Search till the end of file
{
infile.getline ( name, 30 ); infile.getline ( color, 20 ); // Read data..
infile.getline ( model, 6 ); infile.getline ( type, 15 );// ..from..
infile.getline ( rent, 6 ); infile.getline ( status, 15 );// ..file
count++;
if ( strcmp ( num, name ) == 0 ) // Compares the two strings
{
sucess=1;
cleardevice (); // Clearscreen
Car::DisplayScreen();
gotoxy ( 5, 5 );cout << "Record Found!! "<< endl;
gotoxy ( 5, 6 );cout << "Press any key to display......." << endl << endl;
getche ();
gotoxy ( 20, 12 );cout << "NAME ==>> " << name; // Display the..
gotoxy ( 20, 13 );cout << "COLOR==>> " << color;
gotoxy ( 20, 14 );cout << "MODEL==>> " << model; // ..record on..
gotoxy ( 20, 15 );cout << "TYPE==>>> " << type;
gotoxy ( 20, 16 );cout << "RENT===>> " << rent; // ..the screen
gotoxy ( 20, 17 );cout << "STATUS=>> " << status;
gotoxy ( 20, 18 );cout << " Do you want to EDIT this record (y/n)?? ";
char ChoiceToEdit;
ChoiceToEdit = getche();
switch ( ChoiceToEdit )
{
case 'y' : // If want to edit
suc=1;
break;
case 'n' : // If no edit then break and continue searching..
break; // ..for more search results in the file
}
if ( suc==1 )
break;
}
}
if ( (sucess==1) && ( suc==1) )
{
ofstream ouf ( "TempCar.txt",ios::app ); // Open a temporary file
ifstream infile ( "Car.txt" );
infile.seekg(0);
infile.ignore ( 80, '\n' );
for ( int d = 1; d<=count-1; d++ ) // Gets the record from the original..
{
infile.getline ( name, 30 ); infile.getline ( color, 20 );
infile.getline ( model, 6 ); infile.getline ( type, 15 );
infile.getline ( rent, 6 ); infile.getline ( status, 15 );
ouf << endl // ..and copies to the temporary
<< name << endl << color << endl
<< model << endl << type << endl
<< rent << endl << status;
}
// Gets the new field (staus) from user
gotoxy ( 20, 20 );cout << "Enter the status : " ;
cin.getline ( newstatus, 25 );
infile.getline ( name, 30 ); infile.getline ( color, 20 ); //Get the data..
infile.getline ( model, 6 ); infile.getline ( type, 15 );//..of record to..
infile.getline ( rent, 6 ); infile.getline ( status, 15 );//..be edited
ouf << endl // ..and copy it to the temporary..
<< name << endl << color << endl // ..with the new edited status..
<< model << endl << type << endl // ..obtained from the user
<< rent << endl << newstatus;
while ( !infile.eof () ) // Again go till the end of file..
{
infile.getline ( name, 30 ); infile.getline ( color, 20 );//..get the..
infile.getline ( model, 6 ); infile.getline ( type, 15 );//..required..
infile.getline ( rent, 6 ); infile.getline ( status, 15 );//..data
ouf << endl //..and paste all in the
<< name << endl << color << endl //..temporary file
<< model << endl << type << endl
<< rent << endl << status;
}
infile.close(); // Close both..
ouf.close(); // ..files
CarList::DeleteAll ();//Delete all the information from the original file
ofstream oufc ( "Car.txt", ios::app ); // Open both..
ifstream inf ( "TempCar.txt" ); //.. the files
inf.seekg(0);
inf.ignore ( 80, '\n' );
while ( inf.good () )
{ // and again transfers the data..
inf.getline ( name, 30 ); inf.getline ( color, 20 );
inf.getline ( model, 6 ); inf.getline ( type, 15 );
inf.getline ( rent, 6 ); inf.getline ( status, 15 );
oufc << endl // ..from one file to the another
<< name << endl << color << endl
<< model << endl << type << endl
<< rent << endl << status;
}
}
if ( sucess==0 )
{ gotoxy ( 28,14 ); cout << "Record not Found !!! "<< endl; }
getche ();
infile.close (); // Close the file
ofstream ouft;
ouft.open ( "TempCar.txt", ios::trunc ); // Clears the temporary file
ouft.close();
}
//******** Deletes all the data from file **********\\
void CarList::DeleteAll ()
{
ofstream ouf;
ouf.open ( "Car.txt", ios::trunc );
ouf.close();
}
//////////////////////////// CUSTOMER CLASS //////////////////////////////////
class Customer
{
private:
char Name[30] ; char NIC[15]; char Address[30]; char PhNo[10];
char Car_Issued[25]; char Car_Type[25]; char Color[15]; char Model[7];
char DOI[10]; char DOR[10]; char Status[15];
public:
Customer* Next;
Customer ( )
{ Next=NULL; }
void GetInfo ( Customer* current ) // Gets informatin from user
{
gotoxy (4, 2); cout << "INFORMATION THE CUSTOMER : ";
rectangle ( 330, 28, 555, 50 );
gotoxy (10, 3); cout << "Enter the NAME of the Customer : ";
rectangle ( 330, 60, 485, 83 );
gotoxy (10, 5); cout << "Enter the NIC NUMBER : ";
rectangle ( 330, 92, 575, 115 );
gotoxy (10, 7); cout << "Enter the ADDRESS : ";
rectangle ( 330, 125, 425, 148 );
gotoxy (10, 9); cout << "Enter the PHONE NUMBER : ";
gotoxy (4, 11); cout << "INFORMATION OF VEHICLE ISSUED : ";
rectangle ( 330, 170, 555, 195 );
gotoxy (10, 12);cout << "Make of the Vehicle : ";
rectangle ( 330, 202, 465, 227 );
gotoxy (10, 14);cout << "Type of the Vehicle : ";
rectangle ( 330, 234, 465, 259 );
gotoxy (10, 16);cout << "Color of the Vehicle : ";
rectangle ( 330, 268, 465, 293 );
gotoxy (10, 18);cout << "Model Number of the Vehicle : ";
rectangle ( 330, 300, 465, 325 );
gotoxy (10, 20);cout << "Date Of Issue (DD/MM/YY) : ";
rectangle ( 330, 332, 465, 357 );
gotoxy (10, 22);cout << "Date Of Return (DD/MM/YY) : ";
rectangle ( 330, 364, 465, 389 );
gotoxy (10, 24);cout << "Status : ";
gotoxy (44, 3);cin.getline ( current->Name, 30 ); // Takes the..
gotoxy (44, 5);cin.getline ( current->NIC, 15 );
gotoxy (44, 7);cin.getline ( current->Address, 30 );
gotoxy (44, 9);cin.getline ( current->PhNo, 10 );
gotoxy (44, 12);cin.getline ( current->Car_Issued, 25 );// ..input..
gotoxy (44, 14);cin.getline ( current->Car_Type, 25 );
gotoxy (44, 16);cin.getline ( current->Color, 15 );// ..in the..
gotoxy (44, 18);cin.getline ( current->Model, 7 );
gotoxy (44, 20);cin.getline ( current->DOI, 10 ); // ..correct..
gotoxy (44, 22);cin.getline ( current->DOR, 10 );
gotoxy (44, 24);cin.getline ( current->Status, 15 ); // ..box
}
// Sets the links to make the linked list
void Setlink ( Customer* current, Customer* previous )
{ previous->Next = current; }
// Saves the record permanently to file
void Saving_To_File ( Customer* Curr )
{
ofstream ouf ( "Customer.txt", ios::app ); // Opens the file
ouf << endl
<< Curr->Name << endl << Curr->NIC << endl
<< Curr->Address << endl << Curr->PhNo << endl
<< Curr->Car_Issued << endl << Curr->Color << endl
<< Curr->Model << endl << Curr->DOI << endl
<< Curr->DOR << endl << Curr->Status;
ouf.close(); // File closes
}
// Draws borders around the screen
void DisplayScreen ()
{
int x0 = 0, y0 = 0; // Co-ordinates
int x5 = 5, y5 = 5; // Initialization
int xend = 639, yend = 479;
line ( x0, y0, xend, y0 ); // Outer
line ( xend, y0, xend, yend ); // Border
line ( x0, yend, xend, yend );
line ( x0, y0, x0, yend );
line ( x5, y5, xend-5, y5 );
line ( xend-5, y5, xend-5, yend-5 ); // Inner
line ( x5, yend-5, xend-5, yend-5 ); // Border
line ( x5, y5, x5, yend-5 );
}
};
//////////////////////////// CUSTOMER LIST ///////////////////////////////////
class CustomerList : public Customer
{
private:
Customer* Head;
Customer* Current;
Customer* Previous;
public:
CustomerList ()
{ Head = NULL; }
void AddCustomer ();
void Display ();
void SearchName ( char[] );
void SearchNIC ( char[] );
void DeleteAll ();
void DeleteSpecific ( char[] );
void Edit ( char[] );
};
// Adds a new record to list
void CustomerList::AddCustomer ()
{
Current = new Customer;
Customer :: GetInfo ( Current );
if ( Head == NULL ) // If first record
Head = Current;
else
{
Previous = Head;
while ( Previous->Next != NULL )
Previous = Previous->Next;
Setlink ( Current, Previous ); // Sets the links
}
Previous = Current;
Customer :: Saving_To_File ( Current );//calls function to saves data to file
}
// **************Displays all the records**************\\
void CustomerList::Display ()
{
int count = 0; // Variables..
char name[30]; char nic[15]; char add[30]; char ph[10];
char cariss[25]; char clr[15]; char mdl[7];char doi[10];
char dor[10]; char status[15]; //..declaration
ifstream inf ( "Customer.txt" ); // Opens the file
inf.ignore ( 80, '\n' ); // Ignores first line
while ( inf.good () )
{
count++; // Increases count to keep track of no of records
inf.getline ( name, 30 ); inf.getline ( nic, 15 ); // Read data..
inf.getline ( add, 30 ); inf.getline ( ph, 10 );
inf.getline ( cariss, 25 ); inf.getline ( clr, 15 ); // ..from file
inf.getline ( mdl, 7 ); inf.getline ( doi, 10 );
inf.getline ( dor, 25 ); inf.getline ( status, 15 );
cout << endl << "NAME ===========>> " << name << endl; // Displays..
cout << "N.I.C NO# ======>> " << nic << endl;
cout << "ADDRESS ========>> " << add << endl;
cout << "PHONE NO# ======>> " << ph << endl; // ..the..
cout << "CAR ISSUED =====>> " << cariss << endl;
cout << "COLOR ==========>> " << clr << endl;
cout << "MODEL ==========>> " << mdl << endl;
cout << "DATE OF ISSUE ==>> " << doi << endl; // ..record..
cout << "DATE OF RETURN =>> " << dor << endl;
cout << "STATUS =========>> " << status << endl << endl;
getche ();
}
cout << endl << "There are " << count << " records";//tells how many rec r present
inf.seekg( 0, ios::end );
inf.close(); // Close file
}
// ***********Searches customer by name*************\\
void CustomerList::SearchName ( char no [30] )
{
Customer :: DisplayScreen();
int sucess=0; // Variables..
int col = 22;
char name[30]; char nic[15]; char add[30]; char ph[10];
char cariss[25]; char clr[15]; char mdl[7];char doi[10];// ..declaration
char dor[10]; char status[15];
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
ifstream inf ( "Customer.txt" ); // opens the file
inf.seekg(0);
inf.ignore ( 80, '\n' );
while ( !inf.eof () ) // Search till the end of file
{
inf.getline ( name, 30 ); inf.getline ( nic, 15 ); // Reads data..
inf.getline ( add, 30 ); inf.getline ( ph, 10 );
inf.getline ( cariss, 25 ); inf.getline ( clr, 15 ); // ..from file
inf.getline ( mdl, 7 ); inf.getline ( doi, 10 );
inf.getline ( dor, 25 ); inf.getline ( status, 15 );
if ( strcmp ( no, name ) == 0 ) // Copmpare the 2 strings
{
sucess=1; // If record found
cleardevice ();
Customer::DisplayScreen();
gotoxy ( 5, 5 );cout << "Record Found!! "<< endl;
gotoxy ( 5, 6 );cout << "Press any key to display......." << endl;
getche ();
gotoxy ( 4, 10 );cout << "NAME ===========>> " << name; //Displays..
gotoxy ( 4, 11 );cout << "N.I.C NO# ======>> " << nic;
gotoxy ( 4, 12 );cout << "ADDRESS ========>> " << add;
gotoxy ( 4, 13 );cout << "PHONE NO# ======>> " << ph;
gotoxy ( 4, 14 );cout << "CAR ISSUED =====>> " << cariss;
gotoxy ( 4, 15 );cout << "COLOR ==========>> " << clr; // ..the data
gotoxy ( 4, 16 );cout << "MODEL ==========>> " << mdl;
gotoxy ( 4, 17 );cout << "DATE OF ISSUE ==>> " << doi;
gotoxy ( 4, 18 );cout << "DATE OF RETURN =>> " << dor;
gotoxy ( 4, 19 );cout << "STATUS =========>> " << status;
getche ();
}
}
if ( sucess==0 ) // If record not found
{ gotoxy ( 28, 14 ); cout << "Record not Found !! "<<endl; }
getche ();
inf.close (); // Close the file
}
// **********Search by NIC Number************\\
void CustomerList::SearchNIC ( char no [30] )
{
Customer :: DisplayScreen();
int sucess=0; // Variables..
int col = 22;
char name[30]; char nic[15]; char add[30]; char ph[10];
char cariss[25]; char clr[15]; char mdl[7];char doi[10];// ..Declaration
char dor[10]; char status[15];
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
ifstream inf ( "Customer.txt" ); //Opens the file
inf.seekg(0);
inf.ignore ( 80, '\n' ); // Ignore first line
while ( !inf.eof () ) // Search till the end of file
{
inf.getline ( name, 30 ); inf.getline ( nic, 15 ); // Reads data..
inf.getline ( add, 30 ); inf.getline ( ph, 10 );
inf.getline ( cariss, 25 ); inf.getline ( clr, 15 );
inf.getline ( mdl, 7 ); inf.getline ( doi, 10 ); // ..from file
inf.getline ( dor, 25 ); inf.getline ( status, 15 );
if ( strcmp ( no, nic ) == 0 ) // Compares the two strings
{
sucess=1; // If record found
cleardevice ();
Customer::DisplayScreen();
gotoxy ( 5, 5 );cout << "Record Found!! "<< endl;
gotoxy ( 5, 6 );cout << "Press any key to display......." << endl;
getche ();
gotoxy ( 4, 10 );cout << "NAME ===========>> " << name;// Displays..
gotoxy ( 4, 11 );cout << "N.I.C NO# ======>> " << nic;
gotoxy ( 4, 12 );cout << "ADDRESS ========>> " << add;
gotoxy ( 4, 13 );cout << "PHONE NO# ======>> " << ph; // ..the..
gotoxy ( 4, 14 );cout << "CAR ISSUED =====>> " << cariss;
gotoxy ( 4, 15 );cout << "COLOR ==========>> " << clr;
gotoxy ( 4, 16 );cout << "MODEL ==========>> " << mdl;
gotoxy ( 4, 17 );cout << "DATE OF ISSUE ==>> " << doi; // ..data
gotoxy ( 4, 18 );cout << "DATE OF RETURN =>> " << dor;
gotoxy ( 4, 19 );cout << "STATUS =========>> " << status;
getche ();
}
}
if ( sucess==0 ) // If search not found
{ gotoxy ( 28, 14 ); cout << "Record not Found !! "<<endl; }
getche ();
inf.close (); // Closes the file
}
//*******Searches and deletes a record**********\\
void CustomerList::DeleteSpecific ( char num [30] )
{
cleardevice ();
Customer :: DisplayScreen();
int count=0; int sucess=0; // Variables..
int col = 22;
char name[30]; char nic[15]; char add[30]; char ph[10];
char cariss[25]; char clr[15]; char mdl[7];char doi[10]; //..declaration
char dor[10]; char status[15];
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
ifstream infile ( "Customer.txt" ); // Opens the file
infile.seekg(0);
infile.ignore ( 80, '\n' ); // Ignores first line
while ( !infile.eof () ) // Search till the end of file
{
infile.getline ( name, 30 ); infile.getline ( nic, 15 ); // Reads..
infile.getline ( add, 30 ); infile.getline ( ph, 10 );
infile.getline ( cariss, 25 ); infile.getline ( clr, 15 ); // ..data..
infile.getline ( mdl, 7 ); infile.getline ( doi, 10 );
infile.getline ( dor, 25 ); infile.getline ( status, 15 );//..from file
count++;
if ( strcmp ( num, name ) == 0 ) // If search found
{
sucess=1;
cleardevice ();
Customer::DisplayScreen();
gotoxy ( 5, 5 );cout << "Record Found!! "<< endl;
gotoxy ( 5, 6 );cout << "Press any key to display......." << endl << endl;
getche ();
gotoxy ( 4, 10 );cout << "NAME ===========>> " << name; // Displays..
gotoxy ( 4, 11 );cout << "N.I.C NO# ======>> " << nic;
gotoxy ( 4, 12 );cout << "ADDRESS ========>> " << add;
gotoxy ( 4, 13 );cout << "PHONE NO# ======>> " << ph;
gotoxy ( 4, 14 );cout << "CAR ISSUED =====>> " << cariss;
gotoxy ( 4, 15 );cout << "COLOR ==========>> " << clr; // ..the..
gotoxy ( 4, 16 );cout << "MODEL ==========>> " << mdl;
gotoxy ( 4, 17 );cout << "DATE OF ISSUE ==>> " << doi;
gotoxy ( 4, 18 );cout << "DATE OF RETURN =>> " << dor;
gotoxy ( 4, 19 );cout << "STATUS =========>> " << status; //..record
gotoxy ( 4, 20 );cout << " This Record will be deleted!! ";
getche ();
break;
}
}
if ( sucess==1 )
{
ofstream ouf ( "TempCus.txt",ios::app ); // Opens a temporary file
ifstream infile ( "Customer.txt" );
infile.seekg(0);
infile.ignore ( 80, '\n' );
for ( int d = 1; d<=count-1; d++ )
{
infile.getline ( name, 30 ); infile.getline ( nic, 15 ); //Reads..
infile.getline ( add, 30 ); infile.getline ( ph, 10 ); // ..data..
infile.getline ( cariss, 25 ); infile.getline ( clr, 15 );//..from..
infile.getline ( mdl, 7 ); infile.getline ( doi, 10 );//..original
infile.getline ( dor, 25 ); infile.getline ( status, 15 );
ouf << endl // ..and copies it to the temporary file
<< name << endl << nic << endl
<< add << endl << ph << endl
<< cariss << endl << clr << endl
<< mdl << endl << doi << endl
<< dor << endl << status;
}
// skips the one that is to be deleted
infile.getline ( name, 30 ); infile.getline ( nic, 15 ); // Read the..
infile.getline ( add, 30 ); infile.getline ( ph, 10 );// ..record but..
infile.getline ( cariss, 25 ); infile.getline ( clr, 15 );//..does not..
infile.getline ( mdl, 7 ); infile.getline ( doi, 10 );// ..copies it
infile.getline ( dor, 25 ); infile.getline ( status, 15 );
while ( !infile.eof () ) // again look till the end of file
{ // Read remaining data from file
infile.getline ( name, 30 ); infile.getline ( nic, 15 );
infile.getline ( add, 30 ); infile.getline ( ph, 10 );
infile.getline ( cariss, 25 ); infile.getline ( clr, 15 );
infile.getline ( mdl, 7 ); infile.getline ( doi, 10 );
infile.getline ( dor, 25 ); infile.getline ( status, 15 );
ouf << endl //..and copies it
<< name << endl << nic << endl
<< add << endl << ph << endl
<< cariss << endl << clr << endl //.. to the temporary file
<< mdl << endl << doi << endl
<< dor << endl << status;
}
infile.close(); // Close both file
ouf.close();
CustomerList::DeleteAll (); // Clear all data in the original file
ofstream oufc ( "Customer.txt", ios::app ); // Opens the original file
ifstream inf ( "TempCus.txt" );// ..and the temporary file..
inf.seekg(0);
inf.ignore ( 80, '\n' );
while ( inf.good () ) // While no errors
{
inf.getline ( name, 30 ); inf.getline ( nic, 15 ); // ..get the data..
inf.getline ( add, 30 ); inf.getline ( ph, 10 );
inf.getline ( cariss, 25 ); inf.getline ( clr, 15 );
inf.getline ( mdl, 7 ); inf.getline ( doi, 10 ); //..from temporary..
inf.getline ( dor, 25 ); inf.getline ( status, 15 );
oufc << endl //..and copy it to the
<< name << endl << nic << endl
<< add << endl << ph << endl //..original
<< cariss << endl << clr << endl
<< mdl << endl << doi << endl
<< dor << endl << status;
}
}
if ( sucess==0 ) // If no search results are obtained
{ gotoxy ( 28,14 ); cout << "Record not Found !!! "<< endl; }
getche ();
infile.close ();
ofstream ouft;
ouft.open ( "TempCus.txt", ios::trunc );//Clear all data in temporary file
ouft.close(); // Close temporary file
}
//********Search and edit an record****************\\
void CustomerList::Edit ( char num [30] )
{
cleardevice ();
Customer :: DisplayScreen();
char name[30]; char nic[15]; char add[30]; char ph[10]; // Variables..
char cariss[25]; char clr[15]; char mdl[7];char doi[10];
char dor[10]; char status[15]; //..declaration
char newstatus[25];
int count=0; int sucess=0; int col = 22; int suc=0;
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
ifstream infile ( "Customer.txt" ); //Open file
infile.seekg(0);
infile.ignore ( 80, '\n' );// Ignore first line
while ( !infile.eof () ) // Search till the end of file
{
infile.getline ( name, 30 ); infile.getline ( nic, 15 ); //Read data..
infile.getline ( add, 30 ); infile.getline ( ph, 10 ); //..from..
infile.getline ( cariss, 25 ); infile.getline ( clr, 15 ); //..file
infile.getline ( mdl, 7 ); infile.getline ( doi, 10 );
infile.getline ( dor, 25 ); infile.getline ( status, 15 );
count++;
if ( strcmp ( num, name ) == 0 ) // Compares the two strings
{
sucess=1; // If search found
cleardevice ();
Customer::DisplayScreen();
gotoxy ( 5, 5 );cout << "Record Found!! "<< endl;
gotoxy ( 5, 6 );cout << "Press any key to display......." << endl << endl;
getche ();
gotoxy ( 4, 10 );cout << "NAME ===========>> " << name; //Display..
gotoxy ( 4, 11 );cout << "N.I.C NO# ======>> " << nic;
gotoxy ( 4, 12 );cout << "ADDRESS ========>> " << add;
gotoxy ( 4, 13 );cout << "PHONE NO# ======>> " << ph;
gotoxy ( 4, 14 );cout << "CAR ISSUED =====>> " << cariss;// ..on the..
gotoxy ( 4, 15 );cout << "COLOR ==========>> " << clr;
gotoxy ( 4, 16 );cout << "MODEL ==========>> " << mdl;
gotoxy ( 4, 17 );cout << "DATE OF ISSUE ==>> " << doi;
gotoxy ( 4, 18 );cout << "DATE OF RETURN =>> " << dor; // ..screen
gotoxy ( 4, 19 );cout << "STATUS =========>> " << status;
gotoxy ( 4, 18 );cout << " Do you want to delete this record (y/n)?? ";
char ChoiceToEdit; // Asks which record to edit
ChoiceToEdit = getche();
switch ( ChoiceToEdit )
{
case 'y' : // If yes then break from loop
suc=1;
break;
case 'n' : // If no then continue searching
break;
}
if ( suc==1 )
break;
}
}
if ( (sucess==1) && ( suc==1) )
{
ofstream ouf ( "TempCus.txt",ios::app ); //Open temporary file
ifstream infile ( "Customer.txt" );
infile.seekg(0);
infile.ignore ( 80, '\n' ); // Ignores first line
for ( int d = 1; d<=count-1; d++ )
{
infile.getline ( name, 30 ); infile.getline ( nic, 15 ); // Read..
infile.getline ( add, 30 ); infile.getline ( ph, 10 ); // ..data
infile.getline ( cariss, 25 ); infile.getline ( clr, 15 );//..from..
infile.getline ( mdl, 7 ); infile.getline ( doi, 10 ); //..file
infile.getline ( dor, 25 ); infile.getline ( status, 15 );
ouf << endl // ..and copy to the temporary file
<< name << endl << nic << endl
<< add << endl << ph << endl
<< cariss << endl << clr << endl
<< mdl << endl << doi << endl
<< dor << endl << status;
}
gotoxy ( 20, 20 );cout << "Enter the status : " ; //Get the new status
cin.getline ( newstatus, 25 );
infile.getline ( name, 30 ); infile.getline ( nic, 15 );
infile.getline ( add, 30 ); infile.getline ( ph, 10 );
infile.getline ( cariss, 25 ); infile.getline ( clr, 15 );
infile.getline ( mdl, 7 ); infile.getline ( doi, 10 );
infile.getline ( dor, 25 ); infile.getline ( status, 15 );
ouf << endl // and copy to the temporary file..
<< name << endl << nic << endl // ..the record with new status
<< add << endl << ph << endl
<< cariss << endl << clr << endl
<< mdl << endl << doi << endl
<< dor << endl << newstatus;
while ( !infile.eof () ) // agiain serch the file till the end
{
infile.getline ( name, 30 ); infile.getline ( nic, 15 );
infile.getline ( add, 30 ); infile.getline ( ph, 10 );
infile.getline ( cariss, 25 ); infile.getline ( clr, 15 );
infile.getline ( mdl, 7 ); infile.getline ( doi, 10 );
infile.getline ( dor, 25 ); infile.getline ( status, 15 );
ouf << endl // and copy original data..
<< name << endl << nic << endl //..to the temporary file
<< add << endl << ph << endl
<< cariss << endl << clr << endl
<< mdl << endl << doi << endl
<< dor << endl << status;
}
infile.close(); //Close both..
ouf.close(); // ..files
CustomerList::DeleteAll (); //Delete the original
ofstream oufc ( "Customer.txt", ios::app ); // Open again the original
ifstream inf ( "TempCus.txt" );
inf.seekg(0);
inf.ignore ( 80, '\n' );
while ( inf.good () ) // while no errors
{ // get the data from the temporary file..
inf.getline ( name, 30 ); inf.getline ( nic, 15 );
inf.getline ( add, 30 ); inf.getline ( ph, 10 );
inf.getline ( cariss, 25 ); inf.getline ( clr, 15 );
inf.getline ( mdl, 7 ); inf.getline ( doi, 10 );
inf.getline ( dor, 25 ); inf.getline ( status, 15 );
oufc << endl // ..and copy it again to the original
<< name << endl << nic << endl
<< add << endl << ph << endl
<< cariss << endl << clr << endl
<< mdl << endl << doi << endl
<< dor << endl << status;
}
}
if ( sucess==0 ) // If no record found
{ gotoxy ( 28,14 ); cout << "Record not Found !!! "<< endl; }
getche ();
infile.close (); // Close file
ofstream ouft;
ouft.open ( "TempCus.txt", ios::trunc );// Delete all data from the temporaryfile
ouft.close();
}
//******** Deletes all the data from file **********\\
void CustomerList::DeleteAll ()
{
ofstream ouf;
ouf.open ( "Customer.txt", ios::trunc );
ouf.close();
}
//////////////////////////////// RENT CLASS ///////////////////////////////////
int GTotExp;
int GTotRnt;
class Rent
{
private:
int Day;
int Month;
int Year;
int rent;
int Non_Op_Act;
public:
Rent* Next;
Rent () : rent ( 0 ), Day ( 0 ), Month ( 0 ), Year ( 0 )
{ Next=NULL; }
Rent ( int rn, int mn, int yr ) : rent ( rn ), Month ( mn ), Year ( yr )
{ }
void GetInfo ( Rent* current )
{
do // Checks to see that day does not exceed 31
{
gotoxy ( 10, 7 ); cout << " Enter the Current DAY : ";
cin >> current->Day;
} while ( current->Day > 32 );
do // Checks to see that month does not exceed 12
{
gotoxy ( 10, 8 ); cout << " Enter the Current MONTH : ";
cin >> current->Month;
} while ( current->Month > 12 );
do // Checks to see that year is a four digit figure
{
gotoxy ( 10, 9 ); cout << " Enter the Current YEAR : ";
cin >> current->Year;
} while ( (current->Year < 1000 ) ||(current->Year > 10000));
gotoxy ( 10, 10 ); cout << " Enter the RENT : ";
cin >> current->rent;
gotoxy ( 10, 11 ); cout << " Income form Non-Operational Activities : ";
cin >> current->Non_Op_Act;
}
// Sets the links to form a linked list
void Setlink ( Rent* current, Rent* previous )
{ previous->Next = current; }
// Saves the record to file
void Saving_To_File ( Rent* Curr )
{
ofstream ouf ( "Rent.txt", ios::app ); // Open file
ouf << endl
<< Curr->Day << endl << Curr->Month << endl
<< Curr->Year
<< endl << Curr->rent << endl
<< Curr->Non_Op_Act;
ouf.close(); // File close
}
// Draws borders around the screen
void DisplayScreen ()
{
int x0 = 0, y0 = 0; // Co-ordinates
int x5 = 5, y5 = 5; // Initialization
int xend = 639, yend = 479;
line ( x0, y0, xend, y0 ); // Outer
line ( xend, y0, xend, yend ); // Border
line ( x0, yend, xend, yend );
line ( x0, y0, x0, yend );
line ( x5, y5, xend-5, y5 );
line ( xend-5, y5, xend-5, yend-5 ); // Inner
line ( x5, yend-5, xend-5, yend-5 ); // Border
line ( x5, y5, x5, yend-5 );
}
};
//////////////////////////// RENT LIST //////////////////////////////////////
class RentList : public Rent
{
private:
Rent* Head;
Rent* Current;
Rent* Previous;
public:
RentList ()
{ Head = NULL; }
void AddRent ();
void Display ();
void ShowTotal ();
void TotalMonth ();
void DeleteAll ();
};
void RentList::AddRent ()
{
Current = new Rent;
Rent::GetInfo ( Current );
if ( Head == NULL )
Head = Current;
else
{
Previous = Head;
while ( Previous->Next != NULL )
Previous = Previous->Next;
Setlink ( Current, Previous );
}
Previous = Current;
Saving_To_File ( Current );
}
void RentList::Display ()
{
int count = 0;
char d[10]; char m[10]; char y[10];
char rnt[10]; char nonop[10];
ifstream inf ( "Rent.txt" );
inf.ignore ( 80, '\n' );
while ( !inf.eof () )
{
count++;
inf.getline ( d, 10 );
inf.getline ( m, 10 );
inf.getline ( y, 10 );
inf.getline ( rnt, 10 );
inf.getline ( nonop, 10 );
cout << endl << d << "/" << m << "/" << y << endl;
cout << "RENT ====>>" << rnt << endl;
cout << "NON OP ACT ==>>" << nonop << endl;
}
cout << endl << "There are " << count << " records";
inf.close();
}
void RentList::ShowTotal ()
{
int col = 22;
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
int TotRnt=0; int trent = 0; int tnonop=0;
int d; int m; int y;
int rent=0; int nonop=0;
ifstream infile ( "Rent.txt" );
infile.ignore ( 80, '\n' );
while ( !infile.eof () )
{
infile >> d; infile >> m; infile >> y;
infile >> rent; infile >> nonop;
trent+=rent;
tnonop+=nonop;
for ( int date=1; date<32; date++ )
{
if ( d == date )
TotRnt += rent+nonop ;
}
}
gotoxy (26, 14);cout << "RENT : " << trent - rent;
gotoxy (26, 15);cout << "NON OP ACT : " << tnonop - nonop;
gotoxy (26, 16);cout << " -----";
GTotRnt=TotRnt-(rent+nonop);
gotoxy (26, 17);cout << "Total Incomes : " << GTotRnt;
getche ();
infile.close ();
}
void RentList::TotalMonth()
{
int d; int m; int y;
int rent; int nonop;
int tmnth=0;
ifstream infile ( "Rent.txt" );
infile.ignore ( 80,'\n' );
while ( !infile.eof() )
{
infile >> d; infile >> m; infile >> y;
infile >> rent; infile >> nonop;
for ( int month=1;month<=12;month++ )
{
for ( int day=1;day<=31;day++ )
{
if ( ( day==d ) && (month==m ) )
{
tmnth = rent+nonop;
cout << d << "/" << m << "/" << y << endl;
cout << "TOTAL :" << tmnth <<endl;
getche();
}
}
}
}
}
void RentList::DeleteAll ()
{
ofstream ouf;
ouf.open ( "Rent.txt", ios::trunc );
ouf.close();
}
///////////////////////////// EXPENSE CLASS /////////////////////////////////
class Expense
{
private:
int Day; int Month; int Year;
int Damages; int Repairs; int Wages;
int Disc; int Misc;
public:
Expense* Next;
Expense ()
{ Next=NULL; }
void GetInfo ( Expense* current )
{
gotoxy ( 10, 7 ); cout << " Enter the Current DAY : ";
cin >> current->Day;
gotoxy ( 10, 8 ); cout << " Enter the Current MONTH : ";
cin >> current->Month;
gotoxy ( 10, 9 ); cout << " Enter the Current YEAR : ";
cin >> current->Year;
gotoxy ( 10, 10 ); cout << " Enter Expense from DAMAGES : Rs. ";
cin >> current->Damages;
gotoxy ( 10, 11 ); cout << " Enter Expense from REPAIRS : Rs. ";
cin >> current->Repairs;
gotoxy ( 10, 12 ); cout << " WAGES Paid : Rs. ";
cin >> current->Wages;
gotoxy ( 10, 13 ); cout << " DISCOUNTS Allowed : Rs. ";
cin >> current->Disc;
gotoxy ( 10, 14 ); cout << " MISCELLENEOUS Expenses : Rs. ";
cin >> current->Misc;
}
void Setlink ( Expense* current, Expense* previous )
{ previous->Next = current; }
void Saving_To_File ( Expense* Curr )
{
ofstream ouf ( "Expense.txt", ios::app );
ouf << endl
<< Curr->Day << endl << Curr->Month << endl
<< Curr->Year << endl << Curr->Damages << endl
<< Curr->Repairs << endl << Curr->Wages << endl
<< Curr->Disc << endl << Curr->Misc;
ouf.close();
}
// Draws borders around the screen
void DisplayScreen ()
{
int x0 = 0, y0 = 0; // Co-ordinates
int x5 = 5, y5 = 5; // Initialization
int xend = 639, yend = 479;
line ( x0, y0, xend, y0 ); // Outer
line ( xend, y0, xend, yend ); // Border
line ( x0, yend, xend, yend );
line ( x0, y0, x0, yend );
line ( x5, y5, xend-5, y5 );
line ( xend-5, y5, xend-5, yend-5 ); // Inner
line ( x5, yend-5, xend-5, yend-5 ); // Border
line ( x5, y5, x5, yend-5 );
}
};
//////////////////////////// EXPENSE LIST ////////////////////////////////////
class ExpenseList : public Expense
{
private:
Expense* Head;
Expense* Current;
Expense* Previous;
public:
ExpenseList ()
{ Head = NULL; }
void AddExpense ();
void Display ();
void ShowTotal ();
void DeleteAll ();
void TotalMonth ();
};
//********Adds new record to file***********\\
void ExpenseList::AddExpense ()
{
Current = new Expense;
Expense :: GetInfo ( Current );
if ( Head == NULL )
Head = Current;
else
{
Previous = Head;
while ( Previous->Next != NULL )
Previous = Previous->Next;
Setlink ( Current, Previous );
}
Previous = Current;
Saving_To_File ( Current );
}
//********* Shows all data in file**********\\
void ExpenseList::Display ()
{
int count = 0;
char d[10]; char m[10]; char y[10];
char dam[10]; char rep[10]; char wage[10];
char ds[10]; char ms[10];
ifstream inf ( "Expense.txt" );
inf.ignore ( 80, '\n' );
while ( !inf.eof () )
{
count++;
inf.getline ( d, 10 ); inf.getline ( m, 10 );
inf.getline ( y, 10 ); inf.getline ( dam, 10 );
inf.getline ( rep, 10 ); inf.getline ( wage, 10 );
inf.getline ( ds, 10 ); inf.getline ( ms, 10 );
cout << endl << d << "/" << m << "/" << y << endl;
cout << "DAMAGES =======>> " << dam << endl;
cout << "REPAIRS =======>> " << rep << endl;
cout << "WAGES =========>> " << wage << endl;
cout << "DISCOUNTS =====>> " << ds << endl;
cout << "MISCELLENEOUS==>> " << ms << endl;
getche ();
}
cout << endl << "There are " << count << " records";
inf.close();
}
void ExpenseList::ShowTotal ()
{
cleardevice ();
Expense::DisplayScreen ();
GTotExp=0;
int col = 22;
char process[28] = " P R O C E S S I N G . . . ";
for ( int x = 0; x < 26 ;x++ )
{
gotoxy ( col,12 ); cout << process[x];
col++;
delay ( 100 );
}
ifstream infile ( "Expense.txt" );
int TotExp=0;
int tdam=0; int trep=0; int tds=0; int tms=0; int twage=0;
int d; int m; int y;
int dam; int rep; int ds; int ms; int wage;
infile.ignore ( 80,'\n' );
while ( !infile.eof () )
{
infile >> d; infile >> m; infile >> y;infile >> dam;
infile >> rep; infile >> ds; infile >>ms; infile >> wage;
tdam+=dam; trep+=rep; tds+=ds; tms+=ms; twage+=wage;
for ( int date=1; date < 32; date ++ )
{
if ( d == date )
TotExp+=dam+rep+ds+ms+wage;
}
}
gotoxy (26, 14);cout << "Damages : " << tdam - dam;
gotoxy (26, 15);cout << "Repairs : " << trep - rep;
gotoxy (26, 16);cout << "Wages : " << twage - wage;
gotoxy (26, 17);cout << "Discounts : " << tds - ds;
gotoxy (26, 18);cout << "Miscellenious : " << tms - ms;
gotoxy (26, 19);cout << " -----";
GTotExp = TotExp-(dam+rep+wage+ds+ms);
gotoxy (26, 20);cout << "Total Expenses: " << GTotExp;
getche ();
infile.close ();
}
void ExpenseList::TotalMonth ( )
{
int d; int m; int y; // Variables..
int dam; int rep; int ds; int ms; int wage; //..declaration
int tmnth=0;
ifstream infile ( "Expense.txt" ); // Open file
infile.ignore ( 80,'\n' ); //Ignore first line
while ( !infile.eof() )
{
infile >> d; infile >> m; infile >> y;infile >> dam;
infile >> rep; infile >> ds; infile >>ms; infile >> wage;
for ( int month=1;month<=12;month++ )
{
for ( int day=1;day<=31;day++ )
{
if ( ( day==d ) && (month==m ) )
{
tmnth = dam+rep+ds+ms+wage;
cout << endl <<" " << d << "/" << m << "/" << y << endl;
cout << " " << "TOTAL :" << tmnth << endl << endl;
getche();
}
}
}
}
}
//********** Delets all data in file************\\
void ExpenseList::DeleteAll ()
{
ofstream ouf;
ouf.open ( "Expense.txt", ios::trunc );
ouf.close();
}
//////////////////////////////// MAIN MODULE ////////////////////////////////
class Report : public RentList, public ExpenseList
{
private :
long Land;
long Building;
long Vehicles;
float Cash;
float Bank;
float Payable;
public :
void GetInfo ()
{
RentList::DisplayScreen ();
gotoxy ( 10, 7 ); cout << " Worth of LAND : ";
cin >> Land;
gotoxy ( 10, 8 ); cout << " Worth of BUILDING : ";
cin >> Building;
gotoxy ( 10, 9 ); cout << " Worth of Vehicles : ";
cin >> Vehicles;
gotoxy ( 10, 10 ); cout << " CASH in Hand : ";
cin >> Cash;
gotoxy ( 10, 11 ); cout << " Cash in Bank : ";
cin >> Bank;
gotoxy ( 10, 12 ); cout << " Payables : ";
cin >> Payable;
}
void ShowInfo ()
{
ExpenseList::DisplayScreen ();
ExpenseList::ShowTotal ();
cleardevice ();
RentList::DisplayScreen ();
RentList::ShowTotal ();
cleardevice ();
RentList::DisplayScreen ();
gotoxy ( 20, 1); cout << "BALANCE SHEET " << endl;
gotoxy ( 8, 2); cout << "ASSETS: " << endl;
gotoxy ( 12, 3); cout << "FIXED ASSETS: " << endl;
gotoxy ( 14, 4); cout << "LAND " << Land << endl;
gotoxy ( 14, 5); cout << "Building " << Building << endl;
gotoxy ( 14, 6); cout << "Vehicles " << Vehicles << endl;
gotoxy ( 28, 7); cout << "-------";
gotoxy ( 38, 8);cout << Land+Building+Vehicles;
gotoxy ( 12, 9);cout << "CURRENT ASSETS " << endl;
gotoxy ( 14, 10);cout << "Cash in hand " << Cash << endl;
gotoxy ( 14, 11);cout << "Cash in Bank " << Bank << endl;
gotoxy ( 28, 12);cout << "-------";
gotoxy ( 39, 13);cout << Cash+Bank;
gotoxy ( 38, 14);cout << "-------";
gotoxy ( 39, 15);cout << Land+Building+Vehicles+Cash+Bank;
gotoxy ( 12, 16);cout << "LIABILITIES " << endl;
gotoxy ( 14, 17);cout << "Payables (" << Payable << ")"<< endl;
gotoxy ( 38, 18);cout << "-------";
int Total = Land+Building+Vehicles+Cash+Bank-Payable;
gotoxy ( 14, 19);cout << "TOTAL " << Total;
gotoxy ( 12, 20);cout << "EXPENSES " << GTotExp;
gotoxy ( 12, 21);cout << "RENT " << GTotRnt;
gotoxy ( 28, 22);cout << "-------";
gotoxy ( 12, 23);cout << "PROFIT/LOSS " << GTotRnt-GTotExp;
gotoxy ( 12, 24);cout << "CAPITAL " << Total+(GTotRnt-GTotExp);
}
};
//************Tnteger Constants***************\\
int const RADIUS = 18;
int const StAngle = 270;
int const EndAngle = 90;
//*********** Functions in Main***********\\
char MainMenu ( void );
char Car_Menu ( void );
char Customer_Menu ( void );
char Rent_Menu ( void );
char Expense_Menu ( void );
void Report_Menu ( void );
void Date();
void ShowNames();
int Password ( void );
CarList CarL;
CustomerList CusL;
RentList RentL;
ExpenseList ExpL;
Report RepL;
/////////////////////////////////MAIN-MODULE//////////////////////////////////
int main ()
{
int driver = DETECT, mode; // Graphics..
initgraph ( &driver, &mode, "c:\\tc\\bgi" ); //..Initalization
int Proceed;
do {
Proceed = Password();
} while ( Proceed!=1);
gotoxy ( 22, 21 ); printf ( " ACCESS APPROVED WELCOME!! " );
struct dostime_t t;
_dos_gettime(&t);
gotoxy ( 30, 23 );printf("Login Time is: %2d:%02d:%02d.%02d\n", t.hour, t.minute,
t.second, t.hsecond);
delay (3000);
char Ch_Main, Ch_Cus, Ch_Car, Ch_Rent, Ch_Exp, Ch_Rep;
cleardevice ();
do {
cleardevice ();
Ch_Main = MainMenu ();
switch ( Ch_Main )
{
case '1' :
do {
cleardevice ();
Ch_Car = Car_Menu ();
} while ( Ch_Car != '5' );
break;
case '2' :
do {
cleardevice ();
Ch_Cus = Customer_Menu ();
} while ( Ch_Cus != '5' );
break;
case '3' :
do {
cleardevice ();
Ch_Rent = Rent_Menu ();
} while ( Ch_Rent != '5' );
break;
case '4' :
do {
cleardevice ();
Ch_Exp = Expense_Menu ();
} while ( Ch_Exp != '5' );
break;
case '5' :
cleardevice ();
Report_Menu ();
break;
}
} while ( Ch_Main != '6' );
return ( 0 );
}
int Password ( void )
{
cleardevice(); // Clears screen
char Password[12]="rentacar\r"; // Already assigned password
line ( 130, 180, 500, 180 ); // creates..
rectangle ( 130, 150, 500, 300 );
setfillstyle ( SOLID_FILL, 7 ); // ..the dialouge box..
bar ( 130, 150, 500, 180 );
setfillstyle ( SOLID_FILL, 8 ); // ..where password and user name..
bar ( 130, 180, 500, 300 );
setcolor ( 4 ); // ..can be entered
outtextxy ( 140, 165, " P A S S W O R D V E R I F I C A T I O N " );
setfillstyle ( SOLID_FILL, 0 );
bar ( 200, 200, 450, 230 );
bar ( 200, 240, 450, 270 );
outtextxy ( 130, 210, " NAME " );
outtextxy ( 126, 250, " PASSWORD " );
char pass[20];
int x=203, y=252, x0=26;
char UserName[15];
for( int j=0; j<26; j++ ) // Gets the user name..
{
UserName[j]=getch();
if ( UserName[j] == char (13) ) // ..until enter key is not pressed..
break;
else // ..character by character and prints..
{
settextstyle ( DEFAULT_FONT, HORIZ_DIR, 1 );
gotoxy ( x0, 14 );cout << UserName[j]; // ..on the screen
x0++;
}
}
for( int i=0; i<20; i++ ) // Gets the password..
{
pass[i]=getch(); // ..until enter key is not pressed..
if(pass[i]==char(13))
break;
else
{
settextstyle ( DEFAULT_FONT, HORIZ_DIR, 1 );
outtextxy ( x, y, "*" ); // ..and prints asterix on the screen
x=x+13;
}
}
int sucess=0; // Password Verification
int k=0;
while ( pass[k+1]!='\r')
{
if ( Password[k]==pass[k] ) // checks password character..
{
sucess=1;
k++; //..by character
}
else // If incorrect password
{
sucess=0;
gotoxy ( 22, 21 ); printf ( " INVALID PASSWORD! TRY AGAIN " );
getche ();
break;
}
}
return ( sucess );
}
//////////////////////// DISPLAY SCREEN FOR MAIN MENU ////////////////////////
char MainMenu ()
{
int lx1, lx2;
lx1 = 20; lx2 = 175;
Date ();
setcolor ( 2 );
line ( lx1, 100, lx2, 100 );
line ( lx1, 136, lx2, 136 );
circle ( lx1, 118, RADIUS );
arc ( lx2, 118, StAngle, EndAngle, RADIUS );
settextstyle ( TRIPLEX_FONT, HORIZ_DIR, 1 );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 CARS " );
setcolor ( 2 );
line ( lx1, 160, lx2, 160 );
line ( lx1, 196, lx2, 196 );
circle ( lx1, 178, RADIUS );
arc ( lx2, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 CUSTOMERS " );
setcolor ( 2 );
line ( lx1, 220, lx2, 220 );
line ( lx1, 256, lx2, 256 );
circle ( lx1, 238, RADIUS );
arc ( lx2, 238, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 INCOMES/RENT " );
setcolor ( 2 );
line ( lx1, 280, lx2, 280 );
line ( lx1, 316, lx2, 316 );
circle ( lx1, 298, RADIUS );
arc ( lx2, 298, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 EXPENSES " );
setcolor ( 2 );
line ( lx1, 340, 175, 340 );
line ( lx1, 376, 175, 376 );
circle ( 20, 358, RADIUS );
arc ( 175, 358, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 346, " 5 REPORT " );
setcolor ( 2 );
line ( 20, 400, 175, 400 );
line ( 20, 436, 175, 436 );
circle ( 20, 418, RADIUS );
arc ( 175, 418, StAngle, EndAngle, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 406, " 6 EXIT " );
settextstyle ( TRIPLEX_FONT, HORIZ_DIR, 3 );
setcolor ( 5 );
outtextxy ( 15, 5, " R E N T - A - C A R Database" );
setcolor ( 2 );
line ( 20, 30, 20, 100 );
line ( 20, 30, 410, 30 );
line ( 590, 30, 638, 30);
line ( 638, 30, 638, 480 );
line ( 20, 479, 638, 479 );
line ( 20, 435, 20, 479 );
settextstyle ( TRIPLEX_FONT, HORIZ_DIR, 1 );
ellipse ( 500, 30, 0, 360, 90, 30 );
setcolor ( 3 );
outtextxy ( 440, 20, " MAIN-MENU " );
setcolor (7);
setfillstyle ( SOLID_FILL, 8);
bar ( 330, 125, 505, 325 );
settextstyle ( DEFAULT_FONT, HORIZ_DIR, 2 );
setcolor (7);
outtextxy ( 330, 150, " WELCOME!! " );
outtextxy ( 330, 190, " 2 " );
outtextxy ( 323, 230, " RENT-A-CAR " );
outtextxy ( 330, 270, " AGENCY " );
ShowNames();
char choice;
choice = getche ();
switch ( choice )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( lx1, 118, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 CARS " );
delay ( 1000 );
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( lx1, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 CUSTOMERS " );
delay ( 1000 );
break;
case '3' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( lx1, 238, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 INCOMES/RENT " );
delay ( 1000 );
break;
case '4' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( lx1, 298, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 EXPENSES " );
delay ( 1000 );
break;
case '5' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( lx1, 358, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 346, " 5 REPORT " );
delay ( 1000 );
break;
case '6' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( lx1, 418, RADIUS, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 406, " 6 EXIT " );
delay ( 1000 );
break;
}
return ( choice );
}
/////////////////////////// DISPLAY SCREEN FOR CAR ///////////////////////////
char Car_Menu ()
{
Date();
setcolor ( 2 );
line ( 20, 100, 175, 100 );
line ( 20, 136, 175, 136 );
circle ( 20, 118, RADIUS );
arc ( 175, 118, StAngle, EndAngle, RADIUS );
settextstyle ( TRIPLEX_FONT, HORIZ_DIR, 1 );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 ADD " );
setcolor ( 2 );
line ( 20, 160, 175, 160 );
line ( 20, 196, 175, 196 );
circle ( 20, 178, RADIUS );
arc ( 175, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 DISPLAY " );
setcolor ( 2 );
line ( 20, 220, 175, 220 );
line ( 20, 256, 175, 256 );
circle ( 20, 238, RADIUS );
arc ( 175, 238, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 SEARCH " );
setcolor ( 2 );
line ( 20, 280, 175, 280 );
line ( 20, 316, 175, 316 );
circle ( 20, 298, RADIUS );
arc ( 175, 298, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 DELETE " );
setcolor ( 2 );
line ( 20, 340, 175, 340 );
line ( 20, 376, 175, 376 );
circle ( 20, 358, RADIUS );
arc ( 175, 358, StAngle, EndAngle, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 346, " 5 BACK " );
setcolor ( 5 );
outtextxy ( 15, 5, " R E N T - A - C A R Database" );
setcolor ( 2 );
line ( 20, 30, 20, 100 );
line ( 20, 30, 410, 30 );
line ( 590, 30, 638, 30);
line ( 638, 30, 638, 480 );
line ( 20, 479, 638, 479 );
line ( 20, 376, 20, 479 );
ellipse ( 500, 30, 0, 360, 90, 30 );
setcolor ( 3 );
outtextxy ( 440, 20, " CAR-MENU " );
ShowNames();
char Ch_Car;
Ch_Car = getche ();
switch ( Ch_Car )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 118, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 ADD " );
delay ( 1000 );
setcolor ( 2 );
line ( 195, 118, 230, 118 );
line ( 230, 118, 230, 298 );
line ( 230, 178, 265, 178 );
line ( 230, 298, 265, 298 );
setcolor ( 2 );
line ( 286, 160, 441, 160 );
line ( 286, 196, 441, 196 );
circle ( 286, 178, RADIUS );
arc ( 441, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 ADD NEW " );
setcolor ( 2 );
line ( 286, 288, 441, 288 );
line ( 286, 324, 441, 324 );
circle ( 286, 306, RADIUS );
arc ( 441, 306, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 EDIT " );
char ch;
ch = getche ();
switch ( ch )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 ADD NEW " );
delay ( 1000 );
cleardevice ();
CarL.DisplayScreen();
CarL.AddCar ();
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 306, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 EDIT " );
delay ( 1000 );
cleardevice ();
CarL.DisplayScreen();
CarL.DisplayScreen ();
char SearchName [30];
gotoxy ( 4, 5 );cout << "Enter the Name of Vehicle to search and edit : ";
cin.getline ( SearchName, 30 );
CarL.Edit ( SearchName );
break;
}
return ( Ch_Car );
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 DISPLAY " );
delay ( 1000 );
cleardevice ();
CarL.Display ();
getche ();
return ( Ch_Car );
case '3' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 238, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 SEARCH " );
delay ( 1000 );
setcolor ( 2 );
line ( 195, 238, 230, 238 );
line ( 230, 178, 230, 298 );
line ( 230, 178, 265, 178 );
line ( 230, 298, 265, 298 );
setcolor ( 2 );
line ( 286, 160, 441, 160 );
line ( 286, 196, 441, 196 );
circle ( 286, 178, RADIUS );
arc ( 441, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 BY NAME " );
setcolor ( 2 );
line ( 286, 288, 441, 288 );
line ( 286, 324, 441, 324 );
circle ( 286, 306, RADIUS );
arc ( 441, 306, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 BY COLOR " );
char chc;
chc = getche ();
switch ( chc )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 BY NAME " );
delay ( 1000 );
cleardevice ();
CarL.DisplayScreen ();
char SearchName [30];
gotoxy ( 4, 5 );cout << "Enter the Name of the Vehicle : ";
cin.getline ( SearchName, 30 );
CarL.SearchName ( SearchName );
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 306, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 BY COLOR " );
delay ( 1000 );
cleardevice ();
CarL.DisplayScreen ();
char SearchColor [10];
gotoxy ( 4, 5);cout << "Enter the Color of the Vehicle : ";
cin.getline ( SearchColor, 10 );
CarL.SearchColor ( SearchColor );
break;
}
return ( Ch_Car );
case '4' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 298, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 DELETE " );
delay ( 1000 );
setcolor ( 2 );
line ( 195, 298, 230, 298 );
line ( 230, 178, 230, 298 );
line ( 230, 178, 265, 178 );
line ( 230, 298, 265, 298 );
setcolor ( 2 );
line ( 286, 160, 441, 160 );
line ( 286, 196, 441, 196 );
circle ( 286, 178, RADIUS );
arc ( 441, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 SPECIFIC " );
setcolor ( 2 );
line ( 286, 288, 441, 288 );
line ( 286, 324, 441, 324 );
circle ( 286, 306, RADIUS );
arc ( 441, 306, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 ALL " );
char ChDelCar;
ChDelCar = getche ();
switch ( ChDelCar )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 SPECIFIC " );
delay ( 1000 );
cleardevice ();
CarL.DisplayScreen ();
char SearchName [30];
gotoxy ( 4, 5 );cout << "Enter the Name of Car to delete : ";
cin.getline ( SearchName, 30 );
CarL.DeleteSpecific ( SearchName );
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 306, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 ALL " );
delay ( 1000 );
cleardevice ();
CarL.DisplayScreen ();
setcolor ( 3 );
settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 4 );
outtextxy ( 8, 150, " This will delete all the Data in the File !! " );
settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 3 );
outtextxy ( 60, 220, " ARE YOU SURE YOU WANT TO CONTINUE... " );
outtextxy ( 190, 250, " ( Press 'Y' or 'N') ");
char Ch_Del;
Ch_Del = getche ();
if ( (Ch_Del == 'y') || (Ch_Del == 'Y') )
CarL.DeleteAll ();
else
return ( Ch_Car );
}
return ( Ch_Car );
case '5' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 358, RADIUS, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 346, " 5 BACK " );
delay ( 1000 );
return ( Ch_Car );
}
return (0) ;
}
//////////////////////// DISPLAY SCREEN FOR CUSTOMER ////////////////////////
char Customer_Menu ()
{
Date();
setcolor ( 2 );
line ( 20, 100, 175, 100 );
line ( 20, 136, 175, 136 );
circle ( 20, 118, RADIUS );
arc ( 175, 118, StAngle, EndAngle, RADIUS );
settextstyle ( TRIPLEX_FONT, HORIZ_DIR, 1 );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 ADD " );
setcolor ( 2 );
line ( 20, 160, 175, 160 );
line ( 20, 196, 175, 196 );
circle ( 20, 178, RADIUS );
arc ( 175, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 DISPLAY " );
setcolor ( 2 );
line ( 20, 220, 175, 220 );
line ( 20, 256, 175, 256 );
circle ( 20, 238, RADIUS );
arc ( 175, 238, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 SEARCH " );
setcolor ( 2 );
line ( 20, 280, 175, 280 );
line ( 20, 316, 175, 316 );
circle ( 20, 298, RADIUS );
arc ( 175, 298, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 DELETE " );
setcolor ( 2 );
line ( 20, 340, 175, 340 );
line ( 20, 376, 175, 376 );
circle ( 20, 358, RADIUS );
arc ( 175, 358, StAngle, EndAngle, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 346, " 5 BACK " );
setcolor ( 5 );
outtextxy ( 15, 5, " R E N T - A - C A R Database" );
setcolor ( 2 );
line ( 20, 30, 20, 100 );
line ( 20, 30, 410, 30 );
line ( 590, 30, 638, 30);
line ( 638, 30, 638, 480 );
line ( 20, 479, 638, 479 );
line ( 20, 376, 20, 479 );
ellipse ( 500, 30, 0, 360, 90, 30 );
setcolor ( 3 );
outtextxy ( 410, 20, " CUSTOMER-MENU " );
ShowNames();
setcolor ( 2 );
char Ch_Cus;
Ch_Cus = getche ();
switch ( Ch_Cus )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 118, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 ADD " );
delay ( 1000 );
setcolor ( 2 );
line ( 195, 118, 230, 118 );
line ( 230, 118, 230, 298 );
line ( 230, 178, 265, 178 );
line ( 230, 298, 265, 298 );
setcolor ( 2 );
line ( 286, 160, 441, 160 );
line ( 286, 196, 441, 196 );
circle ( 286, 178, RADIUS );
arc ( 441, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 ADD NEW " );
setcolor ( 2 );
line ( 286, 288, 441, 288 );
line ( 286, 324, 441, 324 );
circle ( 286, 306, RADIUS );
arc ( 441, 306, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 EDIT " );
char ch;
ch = getche ();
switch ( ch )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 ADD NEW " );
delay ( 1000 );
cleardevice ();
setcolor ( 4 );
CusL.DisplayScreen ();
CusL.AddCustomer ( );
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 306, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 EDIT " );
delay ( 1000 );
cleardevice ();
setcolor ( 4 );
CusL.DisplayScreen ();
char SearchName [30];
gotoxy ( 2, 5 );cout << "Enter the Name of Customer to search and edit : ";
cin.getline ( SearchName, 30 );
CusL.Edit ( SearchName );
break;
}
return ( Ch_Cus );
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 DISPLAY " );
delay ( 1000 );
cleardevice ();
CusL.Display ();
getche ();
return ( Ch_Cus );
case '3' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 238, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 SEARCH " );
delay ( 1000 );
setcolor ( 2 );
line ( 195, 238, 230, 238 );
line ( 230, 178, 230, 298 );
line ( 230, 178, 265, 178 );
line ( 230, 298, 265, 298 );
setcolor ( 2 );
line ( 286, 160, 441, 160 );
line ( 286, 196, 441, 196 );
circle ( 286, 178, RADIUS );
arc ( 441, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 BY NAME " );
setcolor ( 2 );
line ( 286, 288, 441, 288 );
line ( 286, 324, 441, 324 );
circle ( 286, 306, RADIUS );
arc ( 441, 306, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 BY NIC " );
char ChDel;
ChDel = getche ();
switch ( ChDel )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 BY NAME " );
delay ( 1000 );
cleardevice ();
setcolor ( 4 );
CusL.DisplayScreen ();
char SearchName [30];
gotoxy ( 4, 5 );cout << "Enter the Name of Customer : ";
cin.getline ( SearchName, 30 );
CusL.SearchName ( SearchName );
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 306, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 BY NIC " );
delay ( 1000 );
cleardevice ();
setcolor ( 4 );
CusL.DisplayScreen ();
char SearchNIC [10];
gotoxy ( 4, 5);cout << "Enter the NIC Number : ";
cin.getline ( SearchNIC, 10 );
CusL.SearchNIC ( SearchNIC );
break;
}
return ( Ch_Cus );
case '4' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 298, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 DELETE " );
delay ( 1000 );
setcolor ( 2 );
line ( 195, 298, 230, 298 );
line ( 230, 178, 230, 298 );
line ( 230, 178, 265, 178 );
line ( 230, 298, 265, 298 );
setcolor ( 2 );
line ( 286, 160, 441, 160 );
line ( 286, 196, 441, 196 );
circle ( 286, 178, RADIUS );
arc ( 441, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 SPECIFIC " );
setcolor ( 2 );
line ( 286, 288, 441, 288 );
line ( 286, 324, 441, 324 );
circle ( 286, 306, RADIUS );
arc ( 441, 306, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 ALL " );
char ChDelCus;
ChDelCus = getche ();
switch ( ChDelCus )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 SPECIFIC " );
delay ( 1000 );
cleardevice ();
setcolor ( 4 );
CusL.DisplayScreen ();
char SearchName [30];
gotoxy ( 4, 5 );cout << "Enter the Name of Customer to delete : ";
cin.getline ( SearchName, 30 );
CusL.DeleteSpecific ( SearchName );
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 306, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 ALL " );
delay ( 1000 );
cleardevice ();
setcolor ( 4 );
CusL.DisplayScreen ();
setcolor ( 3 );
settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 4 );
outtextxy ( 10, 150, " This will delete all the Data in the File !! " );
settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 3 );
outtextxy ( 60, 220, " ARE YOU SURE YOU WANT TO CONTINUE... " );
outtextxy ( 190, 250, " ( Press 'Y' or 'N') ");
char Ch_Del;
Ch_Del = getche ();
if ( (Ch_Del == 'y') || (Ch_Del == 'Y') )
CusL.DeleteAll ();
else
return ( Ch_Cus );
}
return ( Ch_Cus );
case '5' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 358, RADIUS, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 346, " 5 BACK " );
delay ( 1000 );
return ( Ch_Cus );
}
return (0) ;
}
/////////////////////////// DISPLAY SCREEN FOR RENT //////////////////////////
char Rent_Menu ()
{
Date();
setcolor ( 2 );
line ( 20, 100, 175, 100 );
line ( 20, 136, 175, 136 );
circle ( 20, 118, RADIUS );
arc ( 175, 118, StAngle, EndAngle, RADIUS );
settextstyle ( TRIPLEX_FONT, HORIZ_DIR, 1 );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 ADD " );
setcolor ( 2 );
line ( 20, 160, 175, 160 );
line ( 20, 196, 175, 196 );
circle ( 20, 178, RADIUS );
arc ( 175, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 DISPLAY " );
setcolor ( 2 );
line ( 20, 220, 175, 220 );
line ( 20, 256, 175, 256 );
circle ( 20, 238, RADIUS );
arc ( 175, 238, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 TOTAL INCOMES " );
setcolor ( 2 );
line ( 20, 280, 175, 280 );
line ( 20, 316, 175, 316 );
circle ( 20, 298, RADIUS );
arc ( 175, 298, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 DELETE " );
setcolor ( 2 );
line ( 20, 340, 175, 340 );
line ( 20, 376, 175, 376 );
circle ( 20, 358, RADIUS );
arc ( 175, 358, StAngle, EndAngle, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 346, " 5 BACK " );
setcolor ( 5 );
outtextxy ( 15, 5, " R E N T - A - C A R Database" );
setcolor ( 2 );
line ( 20, 30, 20, 100 );
line ( 20, 30, 410, 30 );
line ( 590, 30, 638, 30);
line ( 638, 30, 638, 480 );
line ( 20, 479, 638, 479 );
line ( 20, 376, 20, 479 );
ellipse ( 500, 30, 0, 360, 90, 30 );
setcolor ( 3 );
outtextxy ( 440, 20, " RENT-MENU " );
ShowNames();
setcolor (2);
char Ch_Rent;
Ch_Rent = getche ();
switch ( Ch_Rent )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 118, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 ADD " );
delay ( 1000 );
cleardevice ();
setcolor ( 5 );
RentL.DisplayScreen();
RentL.AddRent ( );
return ( Ch_Rent );
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 DISPLAY " );
delay ( 1000 );
cleardevice ();
RentL.Display ();
getche ();
return ( Ch_Rent );
case '3' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 238, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 TOTAL INCOMES " );
delay ( 1000 );
setcolor ( 2 );
line ( 195, 238, 230, 238 );
line ( 230, 178, 230, 298 );
line ( 230, 178, 265, 178 );
line ( 230, 298, 265, 298 );
setcolor ( 2 );
line ( 286, 160, 441, 160 );
line ( 286, 196, 441, 196 );
circle ( 286, 178, RADIUS );
arc ( 441, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 MONTH TOTAL " );
setcolor ( 2 );
line ( 286, 288, 441, 288 );
line ( 286, 324, 441, 324 );
circle ( 286, 306, RADIUS );
arc ( 441, 306, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 TOTAL " );
char ChDel;
ChDel = getche ();
switch ( ChDel )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 MONTH TOTAL " );
delay ( 1000 );
cleardevice ();
setcolor ( 3 );
RentL.TotalMonth ();
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 306, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 TOTAL " );
delay ( 1000 );
cleardevice ();
setcolor ( 3 );
RentL.DisplayScreen();
RentL.ShowTotal ();
break;
}
return ( Ch_Rent );
case '4' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 298, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 DELETE " );
delay ( 1000 );
cleardevice ();
setcolor ( 5 );
RentL.DisplayScreen();
setcolor ( 3 );
settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 4 );
outtextxy ( 10, 150, " This will delete all the Data in the File !! " );
settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 3 );
outtextxy ( 60, 220, " ARE YOU SURE YOU WANT TO CONTINUE... " );
outtextxy ( 190, 250, " ( Press 'Y' or 'N') ");
char Ch_Del;
Ch_Del = getche ();
if ( (Ch_Del == 'y') || (Ch_Del == 'Y') )
RentL.DeleteAll ();
else
return ( Ch_Rent );
return ( Ch_Rent );
case '5' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 358, RADIUS, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 346, " 5 BACK " );
delay ( 1000 );
return ( Ch_Rent );
}
return (0) ;
}
/////////////////////////// DISPLAY SCREEN FOR EXPENSES ////////////////////////
char Expense_Menu ()
{
Date();
setcolor ( 2 );
line ( 20, 100, 175, 100 );
line ( 20, 136, 175, 136 );
circle ( 20, 118, RADIUS );
arc ( 175, 118, StAngle, EndAngle, RADIUS );
settextstyle ( TRIPLEX_FONT, HORIZ_DIR, 1 );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 ADD " );
setcolor ( 2 );
line ( 20, 160, 175, 160 );
line ( 20, 196, 175, 196 );
circle ( 20, 178, RADIUS );
arc ( 175, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 DISPLAY " );
setcolor ( 2 );
line ( 20, 220, 175, 220 );
line ( 20, 256, 175, 256 );
circle ( 20, 238, RADIUS );
arc ( 175, 238, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 TOTAL EXPENSES " );
setcolor ( 2 );
line ( 20, 280, 175, 280 );
line ( 20, 316, 175, 316 );
circle ( 20, 298, RADIUS );
arc ( 175, 298, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 DELETE " );
setcolor ( 2 );
line ( 20, 340, 175, 340 );
line ( 20, 376, 175, 376 );
circle ( 20, 358, RADIUS );
arc ( 175, 358, StAngle, EndAngle, RADIUS );
setcolor ( 4 );
outtextxy ( 0, 346, " 5 BACK " );
setcolor ( 5 );
outtextxy ( 15, 5, " R E N T - A - C A R Database" );
setcolor ( 2 );
line ( 20, 30, 20, 100 );
line ( 20, 30, 410, 30 );
line ( 590, 30, 638, 30);
line ( 638, 30, 638, 480 );
line ( 20, 479, 638, 479 );
line ( 20, 376, 20, 479 );
ellipse ( 500, 30, 0, 360, 90, 30 );
setcolor ( 3 );
outtextxy ( 420, 20, " EXPENSE-MENU " );
ShowNames();
setcolor (2);
char Ch_Expense;
Ch_Expense = getche ();
switch ( Ch_Expense )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 118, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 106, " 1 ADD " );
delay ( 1000 );
cleardevice ();
setcolor ( 3 );
ExpL.DisplayScreen ();
ExpL.AddExpense ();
return ( Ch_Expense );
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 166, " 2 DISPLAY " );
delay ( 1000 );
cleardevice ();
ExpL.Display ();
getche ();
return ( Ch_Expense );
case '3' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 238, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 226, " 3 TOTAL EXPENSES " );
delay ( 1000 );
setcolor ( 2 );
line ( 195, 238, 230, 238 );
line ( 230, 178, 230, 298 );
line ( 230, 178, 265, 178 );
line ( 230, 298, 265, 298 );
setcolor ( 2 );
line ( 286, 160, 441, 160 );
line ( 286, 196, 441, 196 );
circle ( 286, 178, RADIUS );
arc ( 441, 178, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 MONTH TOTAL " );
setcolor ( 2 );
line ( 286, 288, 441, 288 );
line ( 286, 324, 441, 324 );
circle ( 286, 306, RADIUS );
arc ( 441, 306, StAngle, EndAngle, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 TOTAL " );
char ChDel;
ChDel = getche ();
switch ( ChDel )
{
case '1' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 178, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 166, " 1 MONTH TOTAL " );
delay ( 1000 );
cleardevice ();
setcolor ( 3 );
ExpL.TotalMonth ();
break;
case '2' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 286, 306, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 266, 294, " 2 TOTAL " );
delay ( 1000 );
cleardevice ();
setcolor ( 3 );
ExpL.DisplayScreen();
ExpL.ShowTotal ();
break;
}
return ( Ch_Expense );
case '4' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 298, RADIUS, RADIUS );
setcolor ( 14 );
outtextxy ( 0, 286, " 4 DELETE " );
delay ( 1000 );
cleardevice ();
setcolor ( 3 );
ExpL.DisplayScreen();
setcolor ( 3 );
settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 4 );
outtextxy ( 10, 150, " This will delete all the Data in the File !! " );
settextstyle ( SANS_SERIF_FONT, HORIZ_DIR, 3 );
outtextxy ( 60, 220, " ARE YOU SURE YOU WANT TO CONTINUE... " );
outtextxy ( 190, 250, " ( Press 'Y' or 'N') ");
char Ch_Del;
Ch_Del = getche ();
if ( (Ch_Del == 'y') || (Ch_Del == 'Y') )
ExpL.DeleteAll ();
else
return ( Ch_Expense );
return ( Ch_Expense );
case '5' :
setfillstyle ( SOLID_FILL, 4 );
fillellipse ( 20, 358, RADIUS, RADIUS );
setcolor ( 14 );
delay ( 1000 );
outtextxy ( 0, 346, " 5 BACK " );
return ( Ch_Expense );
}
return (0) ;
}
void Report_Menu ()
{
RepL.GetInfo();
cleardevice();
RepL.ShowInfo();
getche ();
}
// Gets the system date and time and displays it
void Date (void)
{
struct dosdate_t d;
_dos_getdate ( &d );
setcolor ( GREEN );
rectangle ( 450, 70, 650, 105 );
rectangle ( 450, 75, 650, 100 );
gotoxy ( 61,6 ); printf( "%d/%d/%d", d.day, d.month, d.year );
if (d.dayofweek==0)
cout << " Sunday";
if (d.dayofweek==1)
cout << " Monday";
if (d.dayofweek==2)
cout << " Tuesday";
if (d.dayofweek==3)
cout << " Wednesday";
if (d.dayofweek==4)
cout << " Thursday";
if (d.dayofweek==5)
cout << " Friday";
if (d.dayofweek==6)
cout << " Saturday";
}
//Function that shows the names
void ShowNames ()
{
settextstyle ( DEFAULT_FONT, HORIZ_DIR, 2 );
setcolor ( 2 );
line ( 450, 350, 639, 350 );
line ( 435, 375, 639, 375 );
line ( 435, 375, 450, 350 );
setcolor ( 14 );
outtextxy ( 452, 358, " GEC");
setcolor ( 2 );
line ( 420, 400, 639, 400 );
line ( 405, 425, 639, 425 );
line ( 405, 425, 420, 400 );
setcolor ( 14 );
outtextxy ( 443, 408, "TECHNICAL");
setcolor ( 2 );
line ( 390, 450, 639, 450 );
line ( 375, 475, 639, 475 );
line ( 375, 475, 390, 450 );
setcolor ( 14 );
outtextxy ( 420, 458,"INSTITUTE" );
setcolor (2);
settextstyle ( TRIPLEX_FONT, HORIZ_DIR, 1 );
}
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||