ورود

نسخه کامل مشاهده نسخه کامل : در خواست برنامه c++



shokoufeye anar
28-12-2008, 11:28
سلام
من یه برنامه میخوام به زبان c++
برنامه نویسی خودم افتضاحه
ممنون میشم اگه کمکم کنید به نمره اش احتیاج دارم

این برنامه باید نام و نام خانوادگی دانشجو رو دریافت کنه
امکان اضافه کردن و حذف دانشجو رو داشته باشه
نمرات رو بگیره و معدل گیری کنه
و برحسب الفبا لیست اسامی رو مرتب کنه

mother7
28-12-2008, 14:14
salam ...akhare hafte mitooonam in barname ro behet bedam ... age dust dahsti khabar bede ....alan mosaferat hastam ..

shokoufeye anar
29-12-2008, 12:39
واقعا ممنون
فقط یه چیزی جا افتاده اونم امکان جستجوی دانشجو
اگه بتونی یه ایمیلی چیزی بهم بدی که خیالم راحت تر بشه ممنون میشم
منتظرم

shokoufeye anar
29-12-2008, 12:45
salam ...akhare hafte mitooonam in barname ro behet bedam ... Age dust dahsti khabar bede ....alan mosaferat hastam ..

واقعاممنون
فقط یه چیزی جاافتاده اونم جستجوی دانشجو
منتظرم ممنون

shokoufeye anar
04-01-2009, 17:55
من هنوز منتظرم هاااااااااا
هیچکس دیگه ای نیست کمک کنه؟
من به نمره این پروژه احتیاج دارم
خواهش میکنم کمک کنید!!!!!!!!!!

parsinet
19-01-2009, 18:05
کسی این برنامه رو نداره بزاره برا دانلود خیلی فوریه

man7tomani
19-01-2009, 19:37
با کدوم محیط؟tcp?

فاطـمه
19-01-2009, 19:43
دوستان میدونند که درخواست پروژه تو این انجمن ممنوعه دیگه؟!

برزگري
21-01-2009, 22:28
سلام كد برنامه ي حركت اسب رو لازم دارم تا فردا
خواهش مي كنم كمكم كنيد

javadyousefi
14-02-2009, 23:13
// student.cpp : Defines the entry point for the console application.
by javad yousefi//

#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using std::cout;
using std::cin;
using std::fixed;
#include <iomanip>
using std::setprecision;
#include <string>
using std::string;

void menu(void);
const int maxcourse=20;
const int maxterm=12;
FILE *stFile;

struct course
{
int id;
char name[20];
char teacherName[20];
int unit;
float grade;
};
struct date
{
int day;
int month;
int year;
};
struct term
{
int id;
int courseNo,unitNo;
float avg;
course listOfCourse[maxcourse];
};

struct student
{
string stdID;
char firstName[10];
char lastName[20];
char fatherName[10];
date birthdate;
string melliCode;
string tellNo;
char reshte[30];
char gerayesh[30];
char maghta[20];
int termNo;
int thisTerm;
term listOfTerm[maxterm];
}st;
//************************************************** ********************
void clrscr()
{
COORD coordScreen={0,0};
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);

GetConsoleScreenBufferInfo(hConsole,&csbi);
dwConSize=csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole,TEXT(''),dwCon Size,coordScreen,&cCharsWritten);
SetConsoleCursorPosition(hConsole,coordScreen);
}
//************************************************** ********************
/*get student information*/
void addStudent()
{
clrscr();
int i,j,k,n;
stFile=fopen("st1.JY","a+b");
if(!stFile)
{
cout<<"can't open file";
return;
}//end if
cout<<"\nplz enter number of student to add : ";
cin>>n;

for(i=0;i<n;i++)
{
cout<<"\nEnter information for "<<i+1<<" student\n\n";
cout<<"enter Id : ";
cin>>st.stdID;
cout<<"enter first name :";
scanf("%s",st.firstName);
cout<<"enter last name :";
scanf("%s",st.lastName);
cout<<"enter father name :";
scanf("%s",st.fatherName);
cout<<"enter birthdate (day,month,year)";
scanf("%d%d%d",&st.birthdate.day,&st.birthdate.month,&st.birthdate.year);
cout<<"enter Melli code : ";
cin>>st.melliCode;
cout<<"enter tell number : ";
cin>>st.tellNo;
cout<<"enter reshte : ";
scanf("%s",st.reshte);
cout<<"enter gerayesh :";
scanf("%s",st.gerayesh);
cout<<"enter maghta :";
scanf("%s",st.maghta);
cout<<"enter number of terms : ";
scanf("%d",&st.termNo);
cout<<"enter number of this term : ";
scanf("%d",&st.thisTerm);

for(j=0;j<st.thisTerm;j++)
{
cout<<"\nPlease enter informations for term "<<j+1<<" : ";
cout<<"\n\tenter number of course : ";
scanf("%d",&st.listOfTerm[j].courseNo);
cout<<"\tenter number of units : ";
scanf("%d",&st.listOfTerm[j].unitNo);
cout<<"\tenter average of term : ";
scanf("%f",&st.listOfTerm[j].avg);

for(k=0;k<st.listOfTerm[j].courseNo;k++)
{
cout<<"\n\nEnter informations for courses : \n\n";
cout<<"\tEnter id of course:";
scanf("%d",&st.listOfTerm[j].listOfCourse[k].id);
cout<<"\tenter course name:";
scanf("%s",st.listOfTerm[j].listOfCourse[k].name);
cout<<"\tenter teacher name:";
scanf("%s",st.listOfTerm[j].listOfCourse[k].teacherName);
cout<<"\tenter unit of this course:";
scanf("%d",&st.listOfTerm[j].listOfCourse[k].unit);
cout<<"\tenter grade of this course:";
scanf("%f",&st.listOfTerm[j].listOfCourse[k].grade);
}//End for
}//End for
}//end for
fwrite(&st,sizeof(student),1,stFile);
cout<<"\ninformation successfully saved !";
clrscr();
fflush(stFile);
menu();
}//End function
//************************************************** ********************
/*print student information*/
void printStudentInformation()
{
clrscr();
string searchId;
int i,j;
int sw=0;

stFile=fopen("st1.JY","rb");
if(!stFile)
{
cout<<"\ncan't open file";
cout<<"\n\nPress any key to back main menu.";
getch();
menu();
}// end if
cout<<"\nEnter id of student to print his/her information : ";
cin>>searchId;
fread(&st,sizeof(student),1,stFile);
while((!feof(stFile)) && sw==0)
{
if((searchId.compare(st.stdID))==0)
{
sw=1;
cout<<"\nstudent has been found and his/her information is: \n\n";
cout<<"ID : "<<st.stdID;
cout<<"\nname : "<<st.firstName;
cout<<"\nlast name : "<<st.lastName;
cout<<"\nfather name : "<<st.fatherName;
cout<<"\nbirthdate : "<<st.birthdate.year<<"/"<<st.birthdate.month <<"/"<<st.birthdate.day ;
cout<<"\nmelli code : "<<st.melliCode;
cout<<"\nreshte : "<<st.reshte;
cout<<"\ngerayesh : "<< st.gerayesh;
cout<<"\nmaghta : "<<st.maghta;
cout<<"\nterm : "<<st.thisTerm;
cout<<"\ntell number : "<<st.tellNo<<"\n";
cout<<"\n************************************************ **************************";
for(i=0;i<st.thisTerm;i++)
{
cout<<"\n\ninformation for "<<i+1<<" term is : \n\n";
cout<<"-----------------------------\n";
cout<<"course number\tunit number\taverage\n";
cout<<" "<<st.listOfTerm[i].courseNo<<"\t\t "<<st.listOfTerm[i].unitNo<<"\t\t"<<setprecision(2)<<fixed<<st.listOfTerm[i].avg<<"\n";
cout<<"list of courses in "<<i+1<<" term : \n\n";
cout<<"-------------------------------\n";
cout<<"\tcourse Id\tname\tteacher name\tunit number\tgrade\n";
for(j=0;j<st.listOfTerm[i].courseNo;j++)
{
cout<<"\n\t"<<st.listOfTerm[i].listOfCourse[j].id<<"\t "
<<st.listOfTerm[i].listOfCourse[j].name<<"\t"
<<st.listOfTerm[i].listOfCourse[j].teacherName
<<"\t\t"<<st.listOfTerm[i].listOfCourse[j].unit
<<"\t\t"<<setprecision(2)<<fixed
<<st.listOfTerm[i].listOfCourse[j].grade<<"\n";
}//End for
cout<<"\n\n********************************************** ****************************";
}//End for
}//End if
fread(&st,sizeof(student),1,stFile);
if(feof(stFile) && (sw==0))
cout<<"\n\nstudent with this id not found\n ";
}//End while
cout<<"\n\npress any key to back main menu ! ";
getch();
clrscr();
fflush(stFile);
menu();
}//End function
//************************************************** ********************
/* add a course to course list of student this term */
void addCourse()
{

int l;
string studentId;
course addCourse;
int sumGrade=0;
int sw=0;
step1:
clrscr();
cout<<"\nEnter id of student for add a course in this term : ";
cin>>studentId;
stFile=fopen("st1.JY","r+b");
if(!stFile)
{
cout<<"can't open file";
return;
}
fread(&st,sizeof(student),1,stFile);
do
{
if((studentId.compare(st.stdID))==0)
{
sw=1;
sumGrade = ( st.listOfTerm[st.thisTerm-1].avg * st.listOfTerm[st.thisTerm-1].unitNo );
cout<<"Enter id of course to add";
scanf("%d",&addCourse.id);
cout<<"\nEnter name of course to add";
scanf("%s",addCourse.name);
cout<<"\nEnter teacher name of course to add";
scanf("%s",addCourse.teacherName);
cout<<"\nEnter unit of course to add";
scanf("%d",&addCourse.unit);
cout<<"\nEnter grade of course to add";
scanf("%f",&addCourse.grade);
sumGrade += (addCourse.unit * addCourse.grade);
l=st.listOfTerm[st.thisTerm-1].courseNo++;
st.listOfTerm[st.thisTerm-1].listOfCourse[l];
st.listOfTerm[st.thisTerm-1].listOfCourse[l].id=addCourse.id;
strcpy(st.listOfTerm[st.thisTerm-1].listOfCourse[l].name,addCourse.name);
strcpy(st.listOfTerm[st.thisTerm-1].listOfCourse[l].teacherName,addCourse.teacherName);
st.listOfTerm[st.thisTerm-1].listOfCourse[l].unit=addCourse.unit;
st.listOfTerm[st.thisTerm-1].listOfCourse[l].grade=addCourse.grade;
st.listOfTerm[st.thisTerm-1].unitNo+=addCourse.unit;
sumGrade/=st.listOfTerm[st.thisTerm-1].unitNo;
st.listOfTerm[st.thisTerm-1].avg=sumGrade;
break;
}//End if
fread(&st,sizeof(student),1,stFile);
}// end do
while(!feof(stFile));
if(sw==0)
{
cout<<"\n\nThere are no student with this id .";
cout<<"\n\nm or M = main menu \t Enter = try again ";
step2:
char ch=getch();
if(ch=='m'||ch=='M')
menu();
else if(ch==13)
goto step1;
else
{
cout<<"\n\aWrong select ! select m or Enter Please .";
goto step2;
}// end else
}// end if


fseek(stFile,-1L*sizeof(student),SEEK_CUR);
fwrite(&st,sizeof(student),1,stFile);
fflush(stFile);
menu();
}//End function
//************************************************** ****************************
//Load data from file
void loadFromFile()
{
stFile=fopen("st1.JY","rb");
if(!stFile)
{
cout<<"can't open file";
return;
}// End if
while(!feof(stFile))
{
fread(&st,sizeof(student),1,stFile);
}//End while
fflush(stFile);
menu();
}//End function
//************************************************** ********************
//serch student by id
student searchStudentById(string searchId)
{
clrscr();
stFile=fopen("st1.JY","rb");
if(!stFile)
{
cout<<"can't open file";
}// End if
while(!feof(stFile))
{
fread(&st,sizeof(student),1,stFile);
if((searchId.compare(st.stdID))==0)
return(st);
else cout<<"\nThere are no student with this id";
}//End while
fflush(stFile);
menu();
}//End function
//************************************************** ********************
//calcute total average
void totalAvg()
{
clrscr();
float totalAverage;
int i,sum=0,unitTotal=0;
student std;
string studentId;

stFile=fopen("st1.JY","rb");
if(!stFile)
{
cout<<"can't open file";
return;
}// End if
cout<<"\nEnter id of student to calcute his/her total average : ";
cin>>studentId;
std=searchStudentById(studentId);
for(i=0;i<std.thisTerm;i++)
{
sum+=std.listOfTerm[i].avg*std.listOfTerm[i].unitNo;
unitTotal+=std.listOfTerm[i].unitNo;
}//end for
totalAverage=(float)sum/(float)unitTotal;
cout<<" \n Total average for "<<std.firstName<<" "<<std.lastName<<" is : "<<setprecision(2)<<fixed<<totalAverage<<"\n\n\n";
fflush(stFile);
cout<<"Press any key to continue !!";
getch();
clrscr();
menu();
}//End function
//************************************************** ********************
void removeCourse()
{
clrscr();
int removeId,j,i;
string studentId;
int sumGrade=0;

stFile=fopen("st1.JY","r+b");
if(!stFile)
{
cout<<"can't open file";
return;
}// End if
cout<<"\nenter id of student : ";
cin>>studentId;
cout<<"Enter id of course to remove";
scanf("%d",&removeId);
while(!feof(stFile))
{
fread(&st,sizeof(student),1,stFile);
if((studentId.compare(st.stdID))==0)
{
sumGrade=(st.listOfTerm[st.thisTerm-1].avg * st.listOfTerm[st.thisTerm-1].unitNo);
for(i=0;i<st.listOfTerm[st.thisTerm-1].courseNo;i++)
if(removeId==st.listOfTerm[st.thisTerm-1].listOfCourse[i].id)
{
st.listOfTerm[st.thisTerm-1].unitNo-=st.listOfTerm[st.thisTerm-1].listOfCourse[i].unit;
sumGrade-=(st.listOfTerm[st.thisTerm-1].listOfCourse[i].unit * st.listOfTerm[st.thisTerm-1].listOfCourse[i].grade);
for(j=i;j<st.listOfTerm[st.thisTerm-1].courseNo;j++)
st.listOfTerm[st.thisTerm-1].listOfCourse[j]=st.listOfTerm[st.thisTerm-1].listOfCourse[j+1];
st.listOfTerm[st.thisTerm-1].courseNo--;
sumGrade/=st.listOfTerm[st.thisTerm-1].unitNo;
st.listOfTerm[st.thisTerm-1].avg=sumGrade;
cout<<"\nThis course successfully removed.\n\nPress any key to back main menu";
getch();
}//end if


}//end if
}//end while
fseek(stFile,-1L*sizeof(student),SEEK_CUR);
fwrite(&st,sizeof(student),1,stFile);
fflush(stFile);
clrscr();
menu();
}//End function
//************************************************** ********************
// Edit personal information
void edit_Personal_Information()
{
int sw=0;
student edit_personal;
char op='\0';
string studentId;

clrscr();
stFile=fopen("st1.JY","r+b");
if(!stFile)
{
cout<<"can't open file";
return;
}// End if
step2:cout<<"\nEnter Id of student to edit personal informations : ";
cin>>studentId;
while((!feof(stFile)) && (sw==0))
{
fread(&edit_personal,sizeof(student),1,stFile);
if((studentId.compare(st.stdID))==0)
{
step1: clrscr();
sw=1;
cout<<"\nPress related key for edit \n\n";
cout<<"\tstudent id : i \n\n";
cout<<"\tstudent first name : n\n\n";
cout<<"\tstudent last name : l\n\n";
cout<<"\tstudent father name : f\n\n";
cout<<"\tstudent birthdate : b\n\n";
cout<<"\tstudent melli code : m\n\n";
cout<<"\tstudent tell number : t\n";
op=getch();

switch(op)
{
case'I':
case'i':
cout<<"\nEnter correct id :";
cin>>edit_personal.stdID;
break;
case'N':
case'n':
cout<<"\n\nEnter correct name :";
scanf("%s",edit_personal.firstName);
break;
case'L':
case'l':
cout<<"\n\nEnter correct last name :";
scanf("%s",edit_personal.lastName);
break;
case'f':
case'F':
cout<<"\n\nEnter correct father name :";
scanf("%s",edit_personal.fatherName);
break;
case'B':
case'b':
cout<<"\n\nEnter correct birthdate :";
scanf("%d%d%d",&edit_personal.birthdate.day,&edit_personal.birthdate.month,&edit_personal.birthdate.year);
break;
case'M':
case'm':
cout<<"\n\nEnter correct melli code :";
cin>>edit_personal.melliCode;
break;
case'T':
case't':
cout<<"\n\nEnter correct tell number :";
cin>>edit_personal.tellNo;
break;
default:
cout<<"\a";
cout<<"\n\nwrong select !\n\n";
cout<<"Press m or M to back main menu and press Enter to try again \n";
stepWrong: char ch=getch();
if(ch=='m'||ch=='M')
menu();
else if (ch==13)
goto step1;
else
{
cout<<"\n\awrong select ! Please select m or Enter :\n\n";
goto stepWrong;
}//en else
}//end switch

fseek(stFile,-1L *sizeof(student),SEEK_CUR);
fwrite(&edit_personal,sizeof(student),1,stFile);
}// end if
else
{
cout<<"\n\nThere are no student with this id";
step3: cout<<"\n\nPress m or M to back main menu and press Enter to try again\n";
char ch=getch();
if(ch=='m'||ch=='M')
menu();
else if (ch==13)
goto step2;
else
{
cout<<"\a";
cout<<"\n\nWrong select ! ";
goto step3;
}// end else
} //end else
}// end while

if(op=='i' ||op=='I'||op=='n'||op=='f'||op=='l'||op=='b'||op= ='m'||op=='t'||op=='N'||op=='F'||op=='L'||op=='B'| |op=='M'||op=='T')
cout<<"\n\nYour edit succesfuly done\n\nPress any key to back main menu\n";
getch();
clrscr();
menu();
}//end function
//************************************************** ********************
void edit_Education_Information()
{
char op1,op2,op3;
int editTerm,editCourse,x;
student editedStudent;
string studentId;
int sw=0;

clrscr();
stFile=fopen("st1.JY","r+b");
if(!stFile)
{
cout<<"can't open file";
return;
}// End if
step1:cout<<"\nEnter Id of student to edit education information : ";
cin>>studentId;
while((!feof(stFile)) && (sw==0))
{
fread(&editedStudent,sizeof(student),1,stFile);
if((studentId.compare(st.stdID))==0)
{
sw=1;
cout<<"\nPress related key for edit \n\n";
cout<<"\tField(reshte) : r\n\n";
cout<<"\tgerayesh : g\n\n";
cout<<"\tmaghta : m\n\n";
cout<<"\tnumber of terms : t\n\n";
cout<<"\tnumber of this term : s\n\n";
cout<<"\tList of term : l\n";
op1=getch();

switch(op1)
{
case'R':
case'r':
cout<<"Enter correct field(reshte) :";
scanf("%s",editedStudent.reshte);
break;
case'G':
case'g':
cout<<"Enter correct gerayesh :";
scanf("%s",editedStudent.gerayesh);
break;
case'M':
case'm':
cout<<"Enter correct maghta :";
scanf("%s",editedStudent.maghta);
break;
case'T':
case't':
cout<<"Enter correct number of term :";
scanf("%d",&editedStudent.termNo);
break;
case's':
case'S':
cout<<"Enter correct number of this term :";
scanf("%d",&editedStudent.thisTerm);
break;
case'L':
case'l':
clrscr();
stepTerm: cout<<"Enter id of term to edit informations : ";
scanf("%d",&editTerm);
if(editTerm>editedStudent.thisTerm)
{
cout<<"\n\nthis student is not pass the "<<editedStudent.thisTerm<<" term yet.";
step:cout<<"\n\npress m or M to back main menu and press Enter to try again\n\n";
char ch=getch();
if(ch==13)
goto stepTerm;
else if(ch=='m'||ch=='M')
menu();
else
{
cout<<"\a";
cout<<"\n\nwrong selet !";
goto step;
}// end else
}// end if
else
{
cout<<"\n\npress related key : \n\n";
cout<<"\tnumber of course : c\n\n";
cout<<"\tnumber of units : u\n\n";
cout<<"\taverage : a\n\n";
cout<<"\tlist of courses of "<<editTerm<<" term : d\n";
op2=getch();

switch(op2)
{
case'C':
case'c':
cout<<"Enter correct number of courses : ";
scanf("%d",&editedStudent.listOfTerm[editTerm-1].courseNo);
break;
case'U':
case'u':
cout<<"Enter correct number of units : ";
scanf("%d",&editedStudent.listOfTerm[editTerm-1].unitNo);
break;
case'A':
case'a':
cout<<"Enter correct average of this term : ";
scanf("%f",&editedStudent.listOfTerm[editTerm-1].avg);
break;
case'D':
case'd':
clrscr();
stepCourse: cout<<"Enter id of course to edit informations : ";
scanf("%d",&editCourse);
for(x=0;x<editedStudent.listOfTerm[editTerm-1].courseNo;x++)
if(editCourse==editedStudent.listOfTerm[editTerm-1].listOfCourse[x].id)
{
cout<<"\n\npress related key : \n\n";
cout<<"\tid of course : i\n\n";
cout<<"\tname of course : n\n\n";
cout<<"\tunit of course : u\n\n";
cout<<"\tgrade of course : g\n\n";
cout<<"\tteacher name : t\n";
op3=getch();

switch(op3)
{
case'I':
case'i':
cout<<"Enter correct id of course : ";
scanf("%d",&editedStudent.listOfTerm[editTerm-1].listOfCourse[x].id);
break;
case'N':
case'n':
cout<<"Enter correct name of course : ";
scanf("%s",editedStudent.listOfTerm[editTerm-1].listOfCourse[x].name);
break;
case'U':
case'u':
cout<<"Enter correct unit of this course : ";
scanf("%d",&editedStudent.listOfTerm[editTerm-1].listOfCourse[x].unit);
break;
case'G':
case'g':
cout<<"Enter correct garde of course : ";
scanf("%f",&editedStudent.listOfTerm[editTerm-1].listOfCourse[x].grade);
break;
case'T':
case't':
cout<<"Enter correct teacher name of course : ";
scanf("%s",editedStudent.listOfTerm[editTerm-1].listOfCourse[x].teacherName);
break;
clrscr();
}//End switch op3
}//End if
else
{
cout<<"\n\nThere are no course with this id in term "<< editTerm << " for "<<editedStudent.firstName<<" "<<editedStudent.lastName;
steptry: cout<<"\n\npress m or M to back main menu and press Enter to try again\n";
char ch=getch();
if (ch=='m'||ch=='M')
menu();
else if(ch==13)
goto stepCourse;
else
{
cout<<"\a";
cout<<"\n\nwrong Select ! Try again";
goto steptry;
}// end else

}// end else
}//end switch op2
}//end else
}//end switch op1
}// end if
else
{
cout<<"\n\nThere are no student with this id";
step2: cout<<"\n\nPress m or M to back main menu and press Enter to try again\n";
char ch=getch();
if(ch=='m'||ch=='M')
menu();
else if (ch==13)
goto step1;
else
{
cout<<"\a";
cout<<"\n\nWrong select ! ";
goto step2;
}// end else
}// end else
}// end while
fseek(stFile,-1L *sizeof(student),SEEK_CUR);
fwrite(&editedStudent,sizeof(student),1,stFile);
fflush(stFile);
clrscr();
menu();
}//end function
//************************************************** ********************
/*Edit information of student */
void editInformation()
{
char op1;
clrscr();
step1:cout<<"\nfor edit each item press related key : \n\n";
cout<<"\tpersonal information : 1\n";
cout<<"\teducation information : 2\n";
op1=getch();
if(op1=='1')
edit_Personal_Information();
else if(op1=='2')
edit_Education_Information();
else
{
cout<<"\a";
cout<<"\n\nwrong select ! ";
step2: cout<<"\n\nPress m or M back main menu and press Enter to Try again\n";
char ch=getch();
if(ch=='m'||ch=='M')
menu();
else if (ch==13)
{
clrscr();
goto step1;
}// end else if
else
{
cout<<"\a";
cout<<"\n\nWrong select ! ";
goto step2;
}// end else
}// end else
clrscr();
menu();
}//end function
//************************************************** ******************
void listOfStudents()
{
char studentList[20];
char ch;
int t=0;
clrscr();
cout<<"\nplease enter field(reshte) to view students of that : ";
scanf("%s",studentList);
stFile=fopen("st1.JY","r+b");
if(!stFile)
{
cout<<"can't open file";
return;
}// End if
fread(&st,sizeof(student),1,stFile);
while(!feof(stFile))
{
if(strcmp(studentList,st.reshte)==0)
{
t++;
cout<<"\n\t Id\tname\t last name\n";
cout<<"\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n\n";
cout<<"\t"<<st.stdID<<"\t "<<st.firstName<<"\t "<<st.lastName;
cout<<"\n_______________________________________";
cout<<"\n\nThere are "<<t<<" student in "<<studentList<<" field";
}//end if
fread(&st,sizeof(student),1,stFile);
}//end while
if(!t)
cout<<"there are no student in this field";
cout<<"\n\nPress any key to back main menu : ";
getch();
menu();
}//end function
//************************************************** ********************
void listOfCourseOfTeacher()
{
char list[20][20]={{0}};
char teacherList[30];
int i,j,k=0,numberOfCourse=0;

clrscr();
cout<<"please enter teacher name to view his/her clases\n\n";
scanf("%s",teacherList);
stFile=fopen("st1.JY","rb");
if(!stFile)
{
cout<<"can't open file";
return;
}// End if
fread(&st,sizeof(student),1,stFile);
while(!feof(stFile))
{
for(i=0;i<st.termNo;i++)
for(j=0;j<st.listOfTerm[i].courseNo;j++)
if(strcmp(teacherList,st.listOfTerm[i].listOfCourse[j].teacherName)==0)
{
strcpy(list[k],st.listOfTerm[i].listOfCourse[j].name);
k++;
}//end if
fread(&st,sizeof(student),1,stFile);
}//end while
for(int l=0;list[l][0]!='\0';l++)
{
cout<<"\nlesson["<<l+1<<"] = ";
puts(list[l]);
}//end for
cout<<"\n\npress any key to continue ! !";
getch();
menu();
}//end function
//************************************************** ********************
void menu(){
char choice;
clrscr();
step1:
cout<<"\nList of options : \n\n";
cout<<"\tadd student : 1\n\n";
cout<<"\tprint student information : 2\n\n";
cout<<"\tEdit information of students : 3\n\n";
cout<<"\tadd a course : 4\n\n";
cout<<"\tremove a course : 5\n\n";
cout<<"\tcalcute total average : 6\n\n";
cout<<"\tList of students : 7\n\n";
cout<<"\tList of course of teacher : 8\n\n";
cout<<"\tQuit : 9\n\n";
cout<<"Please select your choice : ";
scanf("%c",&choice);
do
{
switch(choice)
{
case '1':
addStudent();
break;
case '2':
printStudentInformation();
break;
case '3':
editInformation();
break;
case '4':
addCourse();
break;
case '5':
removeCourse();
break;
case '6':
totalAvg();
break;
case '7':
listOfStudents();
break;
case '8':
listOfCourseOfTeacher();
break;
case '9':
fclose(stFile);
exit(0);
break;
default:
clrscr();
goto step1;
}//End switch
}//End do
while(choice!=9);
}//end menu
//************************************************** ********************
void main()
{
clrscr();
loadFromFile();
menu();
}//End main