📄 school_fees.cpp
字号:
//******************************************************
// PROJECT SCHOOL FEE ENQUIRY
//*******************************************************
//*******************************************************
// INCLUDED HEADER FILES
//******************************************************
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <dos.h>
#include <iomanip.h>
int design();
char *fname[] = { "************* W E L C O M E ************* ",
"*****FEES MANAGMENT*****",
"*******S O F T W A R E*******",
"~~~~~DEVELOPED BY ~~~~~",
"S U N P R E E T S I N G H"
};
void main_screen();
void draw_box(int s_row,int s_col,int e_row,int e_col);
void help();
//*******************************************************
// THIS CLASS DRAW LINES, BOXES, ETC.
//******************************************************
class DRAW
{
public :
void LINE_HOR(int, int, int, char) ;
void LINE_VER(int, int, int, char) ;
void BOX(int,int,int,int,char) ;
};
//******************************************************
// THIS CLASS CONTROL ALL THE FUNCTIONS RELATED TO FEES
//*******************************************************
class FEE
{
public :
void ADDITION(void) ;
void MODIFICATION(void) ;
void FEE_SLIP(void) ;
void LIST(void) ;
void help();
private :
void DISPLAY(int) ;
void MODIFY_RECORD(int, float, float, float, float, float) ;
int Class ;
float tution, pta, science, pupil, supw ;
};
//*****************************************************
// FUNCTION TO DRAW HORIZONTAL LINE
//*****************************************************
void DRAW :: LINE_HOR(int column1, int column2, int row, char c)
{
for ( column1; column1<=column2; column1++ )
{
gotoxy(column1,row) ;
cout <<c ;
}
}
//******************************************************
// FUNCTION TO DRAW VERTICAL LINE
//******************************************************
void DRAW :: LINE_VER(int row1, int row2, int column, char c)
{
for ( row1; row1<=row2; row1++ )
{
gotoxy(column,row1) ;
cout <<c ;
}
}
//*******************************************************
// FUNCTION TO DRAW BOX LINE
//*******************************************************
void DRAW :: BOX(int column1, int row1, int column2, int row2, char c)
{
char ch=218 ;
char c1, c2, c3, c4 ;
char l1=196, l2=179 ;
if (c == ch)
{
c1=218 ;
c2=191 ;
c3=192 ;
c4=217 ;
l1 = 196 ;
l2 = 179 ;
}
else
{
c1=c ;
c2=c ;
c3=c ;
c4=c ;
l1 = c ;
l2 = c ;
}
gotoxy(column1,row1) ;
cout <<c1 ;
gotoxy(column2,row1) ;
cout <<c2 ;
gotoxy(column1,row2) ;
cout <<c3 ;
gotoxy(column2,row2) ;
cout <<c4 ;
column1++ ;
column2-- ;
LINE_HOR(column1,column2,row1,l1) ;
LINE_HOR(column1,column2,row2,l1) ;
column1-- ;
column2++ ;
row1++ ;
row2-- ;
LINE_VER(row1,row2,column1,l2) ;
LINE_VER(row1,row2,column2,l2) ;
}
//*******************************************************
// FUNCTION TO ADD FEE STRUCTURE IN FEE FILE
//******************************************************
void FEE :: ADDITION(void)
{
fstream file ;
file.open("FEE.DAT", ios::in) ;
if (!file.fail())
return ;
file.close() ;
file.open("FEE.DAT", ios::app) ;
for (int i=1; i<=12; i++)
{
Class = i ;
tution = 0.0 ;
pta = 0.0 ;
science = 0.0 ;
pupil = 0.0 ;
supw = 0.0 ;
file.write((char *) this, sizeof(FEE)) ;
}
file.close() ;
MODIFY_RECORD(12,250,50,30,20,50) ;
MODIFY_RECORD(11,250,50,30,20,50) ;
MODIFY_RECORD(10,250,50,30,20,50) ;
MODIFY_RECORD(9,210,50,20,20,50) ;
MODIFY_RECORD(8,210,50,20,20,0) ;
MODIFY_RECORD(7,200,50,20,20,0) ;
MODIFY_RECORD(6,200,50,20,20,0) ;
MODIFY_RECORD(5,180,50,0,20,0) ;
MODIFY_RECORD(4,180,50,0,20,0) ;
MODIFY_RECORD(3,150,50,0,20,0) ;
MODIFY_RECORD(2,150,50,0,20,0) ;
MODIFY_RECORD(1,150,50,0,20,0) ;
}
//**********************************************************
// FUNCTION TO DISPLAY TOTAL FEE AS LIST
//**********************************************************
void FEE :: LIST(void)
{
clrscr() ;
DRAW d ;
d.BOX(1,2,80,24,218) ;
gotoxy(27,3) ;
cout <<"TOTAL FEES FOR THE CLASSES" ;
d.LINE_HOR(2,79,4,196) ;
gotoxy(5,5) ;
cout <<"CLASS TOTAL FEES" ;
d.LINE_HOR(2,79,6,196) ;
d.LINE_HOR(2,79,22,196) ;
float total ;
int row=8 ;
fstream file ;
file.open("FEE.DAT", ios::in) ;
while (file.read((char *) this, sizeof(FEE)))
{
total = tution + pta + science + pupil + supw ;
gotoxy(6,row) ;
cout <<Class ;
gotoxy(23,row) ;
cout <<total ;
row++ ;
}
file.close() ;
gotoxy(5,23) ;
cout <<"Press any key to continue..." ;
getch() ;
}
//**********************************************************
// FUNCTION FOR HELP
//**********************************************************
void FEE::help()
{
clrscr();
DRAW d ;
d.BOX(1,2,78,24,218) ;
gotoxy(37,4);
cout<<" HELP ";
gotoxy(37,5);
cout<<"*******";
gotoxy(4,7);
cout<<" 1.FEE SLIP ";
gotoxy(4,8);
cout<<" In this option ,you can input the class and name of" ;
gotoxy(4,9);
cout<<" the student and his fee slip can be obtained and printed ";
gotoxy(4,10);
cout<<" using the 'Print Screen ' key on the keyboard .";
gotoxy(4,13);
cout<<" 2.MODIFY ";
gotoxy(4,14);
cout<<" In this option, you can modify the fee structure of a " ;
gotoxy(4,15);
cout<<" class. ";
gotoxy(4,18);
cout<<" 3.LIST ";
gotoxy(4,19);
cout<<" In this option, you can see the list of the total fees";
gotoxy(4,20);
cout<<" applicable to the students all classes from 1 to 12 .";
gotoxy(4,22);
cout<<" Press any key to continue ";
getch();
}
//**********************************************************
// FUNCTION TO DISPLAY THE RECORD FOR THE GIVEN CLASS
//**********************************************************
void FEE :: DISPLAY(int tclass)
{
fstream file ;
file.open("FEE.DAT", ios::in) ;
while (file.read((char *) this, sizeof(FEE)))
{
if (Class == tclass)
{
gotoxy(5,5) ;
cout <<"Class : " <<Class ;
gotoxy(5,6) ;
cout <<"~~~~~~~~~~~~" ;
gotoxy(5,7) ;
cout <<"Tution Fee : " <<tution ;
gotoxy(5,8) ;
cout <<"P.T.A. Fee : " <<pta ;
gotoxy(5,9) ;
cout <<"Science Fee : " <<science ;
gotoxy(5,10) ;
cout <<"Pupil Fund : " <<pupil ;
gotoxy(5,11) ;
cout <<"S.U.P.W. : " <<supw;
break ;
}
}
file.close() ;
}
//**********************************************************
// FUNCTION TO MODIFY THE FEE RECORD FOR THE GIVEN DATA
//**********************************************************
void FEE :: MODIFY_RECORD(int tclass, float ttution, float tpta, float tscience, float tpupil, float tsupw)
{
fstream file ;
file.open("FEE.DAT", ios::in) ;
fstream temp ;
temp.open("temp.dat", ios::out) ;
file.seekg(0,ios::beg) ;
while (!file.eof())
{
file.read((char *) this, sizeof(FEE)) ;
if (file.eof())
break ;
if (tclass == Class)
{
Class = tclass ;
tution = ttution ;
pta = tpta ;
science = tscience ;
pupil = tpupil ;
supw = tsupw ;
temp.write((char *) this, sizeof(FEE)) ;
}
else
temp.write((char *) this, sizeof(FEE)) ;
}
file.close() ;
temp.close() ;
file.open("FEE.DAT", ios::out) ;
temp.open("temp.dat", ios::in) ;
temp.seekg(0,ios::beg) ;
while (!temp.eof())
{
temp.read((char *) this, sizeof(FEE)) ;
if (temp.eof())
break ;
file.write((char *) this, sizeof(FEE)) ;
}
file.close() ;
temp.close() ;
}
// *********************************************************
// FUNCTION TO GIVE DATA TO MODIFY THE FEE RECORD
// **********************************************************
void FEE::MODIFICATION(void)
{
clrscr();
char ch, t1[10] ;
int valid=0, t=0, tclass=0 ;
float t2=0.00;
do
{
valid = 1 ;
gotoxy(5,24) ; clreol() ;
cout <<"Press <ENTER> for EXIT" ;
gotoxy(5,5) ; clreol() ;
cout <<"Enter Class for the Modification of the Fee Structure : " ;
gets(t1) ;
t = atoi(t1) ;
tclass = t ;
if (strlen(t1) == 0)
return ;
if (tclass < 1 || tclass > 12)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7Enter correctly" ;
getch() ;
}
} while (!valid) ;
clrscr() ;
gotoxy(71,1) ;
cout <<"<0>=Exit" ;
DISPLAY(tclass) ;
gotoxy(5,25) ;
clreol() ;
do
{
gotoxy(5,13) ;
clreol() ;
cout <<"Do you want to modify the fee structure (y/n) : " ;
ch = getche() ;
if (ch == '0')
return ;
ch = toupper(ch) ;
} while (ch != 'N' && ch != 'Y') ;
if (ch == 'N')
return ;
float ttution=0.0, tpta=0.0, tscience=0.0, tpupil=0.0, tsupw=0.0 ;
gotoxy(5,13) ;
clreol() ;
gotoxy(5,15) ;
cout <<"Tution Fee : " ;
gotoxy(5,16) ;
cout <<"P.T.A. Fee : " ;
gotoxy(5,17) ;
cout <<"Science Fee : " ;
gotoxy(5,18) ;
cout <<"Pupil Fund : " ;
gotoxy(5,19) ;
cout <<"S.U.P.W. : " ;
int modified = 5 ;
fstream file ;
file.open("FEE.DAT", ios::in) ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -