📄 school_fees.cpp
字号:
while (file.read((char *) this, sizeof(FEE)))
if (Class == tclass)
break ;
file.close() ;
do
{
valid = 1 ;
gotoxy(5,25) ;
clreol() ;
cout <<"Enter Tution fee or Press <ENTER> for no change" ;
gotoxy(19,15) ;
clreol() ;
gets(t1) ;
t2 = atof(t1) ;
ttution = t2 ;
if (t1[0] == '0')
return ;
if (strlen(t1) == 0)
break ;
if (ttution > 1000)
{
valid = 0 ;
gotoxy(5,25) ;
clreol() ;
cout <<"\7Enter correctly" ;
getch() ;
}
} while (!valid) ;
if (strlen(t1) == 0)
{
modified-- ;
ttution = tution ;
gotoxy(19,15) ;
cout <<ttution ;
}
do
{
valid = 1 ;
gotoxy(5,25) ;
clreol() ;
cout <<"Enter P.T.A. fee or Press <ENTER> for no change" ;
gotoxy(19,16) ;
clreol() ;
gets(t1) ;
t2 = atof(t1) ;
tpta = t2 ;
if (t1[0] == '0')
return ;
if (strlen(t1) == 0)
break ;
if (tpta > 1000)
{
valid = 0 ;
gotoxy(5,25) ;
clreol() ;
cout <<"\7Enter correctly" ;
getch() ;
}
} while (!valid) ;
if (strlen(t1) == 0)
{
modified-- ;
tpta = pta ;
gotoxy(19,16) ;
cout <<tpta ;
}
do
{
valid = 1 ;
gotoxy(5,25) ;
clreol() ;
cout <<"Enter Science fee or Press <ENTER> for no change" ;
gotoxy(19,17) ;
clreol() ;
gets(t1) ;
t2 = atof(t1) ;
tscience = t2 ;
if (t1[0] == '0')
return ;
if (strlen(t1) == 0)
break ;
if (tscience > 1000)
{
valid = 0 ;
gotoxy(5,25) ;
clreol() ;
cout <<"\7Enter correctly" ;
getch() ;
}
} while (!valid) ;
if (strlen(t1) == 0)
{
modified-- ;
tscience = science ;
gotoxy(19,17) ;
cout <<tscience ;
}
do
{
valid = 1 ;
gotoxy(5,25) ;
clreol() ;
cout <<"Enter Pupil Fund or Press <ENTER> for no change" ;
gotoxy(19,18) ;
clreol() ;
gets(t1) ;
t2 = atof(t1) ;
tpupil = t2 ;
if (t1[0] == '0')
return ;
if (strlen(t1) == 0)
break ;
if (tpupil > 1000)
{
valid = 0 ;
gotoxy(5,25) ;
clreol() ;
cout <<"\7Enter correctly" ;
getch() ;
}
} while (!valid) ;
if (strlen(t1) == 0)
{
modified-- ;
tpupil = pupil ;
gotoxy(19,18) ;
cout <<tpupil ;
}
do
{
valid = 1 ;
gotoxy(5,25) ;
clreol() ;
cout <<"Enter S.U.P.W. fee or Press <ENTER> for no change" ;
gotoxy(19,19) ;
clreol() ;
gets(t1) ;
t2 = atof(t1) ;
tsupw = t2 ;
if (t1[0] == '0')
return ;
if (strlen(t1) == 0)
break ;
if (tsupw > 1000)
{
valid = 0 ;
gotoxy(5,25) ;
clreol() ;
cout <<"\7Enter correctly" ;
getch() ;
}
} while (!valid) ;
if (strlen(t1) == 0)
{
modified-- ;
tsupw = supw ;
gotoxy(19,19) ;
cout <<tsupw ;
}
if (!modified)
return ;
gotoxy(5,25) ;
clreol() ;
do
{
gotoxy(5,21) ;
clreol() ;
cout <<"Do you want to save (y/n) : " ;
ch = getche() ;
if (ch == '0')
return ;
ch = toupper(ch) ;
} while (ch != 'N' && ch != 'Y') ;
if (ch == 'N')
return ;
MODIFY_RECORD(tclass,ttution,tpta,tscience,tpupil,tsupw) ;
gotoxy(5,23) ;
cout <<"\7Record Modified" ;
gotoxy(5,25) ;
cout <<"Press any key to continue..." ;
getch() ;
}
//**********************************************************
// FUNCTION TO DISPLAY THE FEE SLIP FOR THE CLASS
//**********************************************************
void FEE :: FEE_SLIP(void)
{
clrscr() ;
char ch, t1[10] ;
int valid=0, t=0, tclass=0 ;
do
{
valid = 1 ;
gotoxy(5,24) ;
clreol() ;
cout <<"Press <ENTER> for EXIT" ;
gotoxy(5,5) ;
clreol() ;
cout <<"Enter class of the student : " ;
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) ;
char name[26] ;
do
{
gotoxy(5,6) ;
clreol() ;
cout <<"ENTER NAME OF THE STUDENT" ;
valid = 1 ;
gotoxy(5,7) ;
clreol() ;
cout <<"Name : " ;
gets(name) ;
if (strlen(name) < 1 || strlen(name) > 25)
{
valid = 0 ;
gotoxy(5,25) ;
clreol() ;
cout <<"\7NAME SHOULD NOT GREATER THAN 25" ;
getch() ;
}
} while (!valid) ;
clrscr() ;
DRAW d ;
d.BOX(20,2,61,24,987) ;
gotoxy(29,3) ;
cout<<"GURU HARKRISHAN PUBLIC SCHOOL" ;
int d1, m1, y1 ;
struct date dt;
getdate(&dt);
d1 = dt.da_day ;
m1 = dt.da_mon ;
y1 = dt.da_year ;
gotoxy(45,4) ;
cout <<"Date: " <<d1 <<"/" <<m1 <<"/" <<y1 ;
d.LINE_HOR(21,60,5,196) ;
gotoxy(22,6) ;
cout <<"NAME : " <<name ;
gotoxy(22,7) ;
cout <<"CLASS : " <<tclass ;
d.LINE_HOR(21,60,8,196) ;
gotoxy(21,9) ;
cout <<" PARTICULAR AMOUNT" ;
d.LINE_HOR(21,60,10,196) ;
d.LINE_HOR(21,60,22,196) ;
d.LINE_HOR(46,60,20,196) ;
gotoxy(25,21) ;
cout <<"TOTAL" ;
gotoxy(54,23) ;
cout <<"CASHIER" ;
fstream file ;
file.open("FEE.DAT", ios::in) ;
while (file.read((char *) this, sizeof(FEE)))
if (Class == tclass)
break ;
file.close() ;
float total=0.0 ;
gotoxy(23,12) ;
cout <<"Tution fees " <<setprecision(2) <<tution ;
total = total+tution ;
gotoxy(23,13) ;
cout <<"P.T.A. fees " <<setprecision(2) <<pta ;
total = total+pta ;
gotoxy(23,14) ;
cout <<"Science fees " <<setprecision(2) <<science ;
total = total+science ;
gotoxy(23,15) ;
cout <<"Pupil fund " <<setprecision(2) <<pupil ;
total = total+pupil ;
gotoxy(23,16) ;
cout <<"S.U.P.W. " <<setprecision(2) <<supw ;
total = total+supw ;
d.LINE_VER(9,21,46,179) ;
char tt[15] ;
sprintf(tt,"%f",total) ;
gotoxy(49,21) ;
cout <<tt ;
getch() ;
}
//**********************************************************
// MAIN FUNCTION TO CREATE MENU AND CALL OTHER FUNCTIONS
//**********************************************************
void main(void)
{
clrscr();
FEE fee ;
fee.ADDITION() ;
char ch ;
while (1)
{
main_screen();
draw_box(1,1,24,80);
draw_box(6,20,19,56);
gotoxy(33,8) ;
cout<<" FEE ENQUIRY " ;
gotoxy(34,10) ;
cout<<" OPTIONS " ;
gotoxy(34,12) ;
cout <<"1: FEE SLIP" ;
gotoxy(34,13) ;
cout <<"2: MODIFY" ;
gotoxy(34,14) ;
cout <<"3: LIST" ;
gotoxy(34,15) ;
cout <<"4: HELP" ;
gotoxy(34,16) ;
cout <<"0: QUIT" ;
gotoxy(32,18) ;
cout <<"Enter your choice : " ;
ch = getche() ;
if (ch == 27 || ch == '0')
break ;
else
if (ch == '1')
fee.FEE_SLIP() ;
else
if (ch == '2')
fee.MODIFICATION() ;
else
if (ch == '3')
fee.LIST() ;
else
if(ch== '4')
fee.help();
}
clrscr();
}
//**********************************************************
// FUNCTION FOR THE MAIN SCREEN
//**********************************************************
void main_screen()
{ clrscr();
char c1=178, c2=177, c3=176 ;
int k=1 ;
gotoxy(1,2) ;
for (int i=1; i<=1840; i++)
{
if (k == 1)
cout <<c1 ;
else
if (k == 2)
cout <<c2 ;
else
if (k == 3)
cout <<c3 ;
k++ ;
if (k == 4)
k = 1 ;
}
for (i=6; i<=19; i++)
{
gotoxy(21,i) ;
cout <<" " ;
}
gotoxy(22,21);
cout<<" PROGRAMMER- SUNPREET SINGH";
gotoxy(22,2);
cout<<" PROGRAM ON SCHOOL FEES ENQUIRY ";
}
//**********************************************************
// FUNCTION TO MAKE BOUNDARY
//**********************************************************
void draw_box(int s_row,int s_col,int e_row,int e_col)
{
int i;
for(i=s_col;i<=e_col;i++)
{
gotoxy(i,s_row);
cout<<"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -