求c语言房屋中介系统源代码

2024-12-26 22:13:48
推荐回答(4个)
回答1:

#include
#include
#include
#include
#include
#define ESC 27
#define NULL0
#define LEN sizeof(struct applicant)
#define LENB sizeof(struct job)
#define L sizeof(info1)
#define LB sizeof(info2)
int n,k;
char filename1[10];
char filename2[10];
struct applicant
{
long anum;
char aname[10];
char id[18];
char cert[20];
char rqurjob[20];
struct applicant * next1;
}applcnt[60],info1;
struct job
{
long jnum;
char jname[20];
int need;
struct job * next2;
}jb[100],info2;
/*------------color--------------*/
color()
{
int x1=20,y1=5,x2=60,y2=40,i;
clrscr();
textmode(3);
textbackground(2);
window(x1,y1,x2,y2);
for(i=1;i <=21;i++)
{
gotoxy(1,i);cprintf( " ");}
}
/*-------------menu-----------*/
menu()
{
char c;
color(); textcolor(19); gotoxy(17,3);cprintf( "MENU "); textcolor(4);
gotoxy(9,5);cprintf( "1 --input applicant record ");
gotoxy(9,6);cprintf( "2 --output applicant record ");
gotoxy(9,7);cprintf( "3 --delete applicant record ");
gotoxy(9,8);cprintf( "4 --insert applicant record ");
gotoxy(9,9);cprintf( "5 --search applicant record ");
gotoxy(9,10);cprintf( "6 --open applicant record ");
gotoxy(9,11);cprintf( "7 --input job record ");
gotoxy(9,12);cprintf( "8 --output job record ");
gotoxy(9,13);cprintf( "9 --delete job record ");
gotoxy(9,14);cprintf( "10 --search jobe record ");
gotoxy(9,17);cprintf( "0 --exit ");
gotoxy(15,20);cprintf( "Please Select: ");
c=getch();
if(ESC==c)exit(0);
return(c);
}
/*---------------create applicant information---------------*/
struct applicant * create1(void)
{
struct applicant * p1, * p2; struct applicant * head1;
struct applicant * load1(void);
struct applicant * arrange1(struct applicant * head1);
char c;
color();
n=0;
p1=p2=(struct applicant * )malloc(LEN);
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Num: "); scanf( "%1d ",&p1-> anum);
if(p1-> anum==0){head1=NULL;goto end;}
gotoxy(5,7);cprintf( "Enter Name: "); scanf( "%s ",p1-> aname);
gotoxy(5,9);cprintf( "Enter Your ID Number: "); scanf( "%s ",p1-> id);
gotoxy(5,11);cprintf( "Enter Your Certification: "); scanf( "%s ",p1-> cert);
gotoxy(5,13);cprintf( "Enter Your Ideal Job: "); scanf( "%s ",p1-> rqurjob);
head1=NULL;
while(p1-> anum!=0)
{
n=n+1;
if(n==1)head1=p1;
else p2-> next1=p1;
p2=p1;
p1=(struct applicant *)malloc(LEN);
color();
textcolor(14);
gotoxy(6,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Num: "); scanf( "%1d ",&p1-> anum);
if(p1-> anum==0) goto end;
gotoxy(5,7);cprintf( "Enter Name: "); scanf( "%s ",p1-> aname);
gotoxy(5,9);cprintf( "Enter Your ID number: "); scanf( "%s ",p1-> id);
gotoxy(5,11);cprintf( "Enter Your Certification: "); scanf( "%s ",p1-> cert);
gotoxy(5,13);cprintf( "Enter Your Ideal Job: "); scanf( "%s ",p1-> rqurjob);
}
end:p2-> next1=NULL;
head1=arrange1(head1);
gotoxy(5,16);cprintf( "Save(Y.or,N)? ");
c=getch();
if(c== 'Y '||c== 'y ')save1(head1);
else head1=load1();
return(head1);
}
/*---------------------create job information----------------------*/
struct job *create2(void)
{
struct job * p3, * p4; struct job * head2;
struct job *load2(void);
struct job *arrange2(struct job * head2);
char d;
color();
k=0;
p3=p4=(struct job *)malloc(LENB);
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Job Number: "); scanf( "%1d ",&p3-> jnum);
if(p3-> jnum==0){head2=NULL;goto end;}
gotoxy(5,7);cprintf( "Enter Job Name: "); scanf( "%s ",p3-> jname);
gotoxy(5,9);cprintf( "Enter The Amount Of The Job Needs: "); scanf( "%i ",p3-> need);
head2=NULL;
while(p3-> jnum!=0)
{
k=k+1;
if(k==1)head2=p3;
else p4-> next2=p3;
p4=p3;
p3=(struct job * )malloc(LENB);
color();
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Job Number: "); scanf( "%1d ",&p3-> jnum);
if(p3-> jnum==0) goto end;
gotoxy(5,7);cprintf( "Enter Job Name: "); scanf( "%s ",p3-> jname);
gotoxy(5,9);cprintf( "Enter The Amount Of The Job Needs: "); scanf( "%i ",p3-> need);
}
end:p4-> next2=NULL;
head2=arrange2(head2);
gotoxy(5,12);cprintf( "Save(Y.Or,N)? ");
d=getch();
if(d== 'Y '||d== 'y ')save2(head2);
else head2=load2();
return(head2);
}
/*--------------print applicant information----------------*/
void print1(struct applicant * head1)
{
struct applicant * p5;int i=0;
color();textcolor(14);
p5=head1; textcolor(4);
if(head1-> anum==0)
{ gotoxy(4,4);cprintf( "NO info. of applicant! "); }
else
{
gotoxy(2,2);cprintf( "Number of Records:%d ",n);
textcolor(0);
gotoxy(5,4);cprintf( "Num Name ID Certification Required job ");
if(head1!=NULL)textcolor(1);
do{
gotoxy(5,5+i);cprintf( "%1d ",p5-> anum);
gotoxy(18,5+i);cprintf( "%s ",p5-> aname);
gotoxy(32,5+i);cprintf( "%s ",p5-> id);
gotoxy(50,5+i);cprintf( "%s ",p5-> cert);
gotoxy(75,5+i);cprintf( "%s ",p5-> rqurjob);
i++;
p5=p5-> next1;
}while(p5!=NULL);
}
textcolor(14);
gotoxy(15,20);cprintf( "Any Key Back! ");
getch();
}
/*--------------print job information----------------*/
void print2(struct job * head2)
{
struct job * p7;int k=0;
color();textcolor(14);
p7=head2; textcolor(4);
if(head2-> jnum==0)
{ gotoxy(4,4);cprintf( "NO info. of student! "); }
else
{
gotoxy(2,2);cprintf( "Number of Records:%d ",k);
textcolor(0);
gotoxy(5,4);cprintf( "Job Number Job name Amount of Person in need ");
if(head2!=NULL)textcolor(1);
do{
gotoxy(5,5+k);cprintf( "%1d ",p7-> jnum);
gotoxy(18,5+k);cprintf( "%s ",p7-> jname);
gotoxy(43,5+k);cprintf( "%i ",p7-> need);
k++;
p7=p7-> next2;
}while(p7!=NULL);
}
textcolor(14);
gotoxy(15,20);cprintf( "Any Key Back! ");
getch();
}
/*----------delelte applicant-----------*/
struct applicant *del1(struct applicant * head1)
{
struct applicant * p1, * p2;long anum;char c;
color();textcolor(14);
gotoxy(7,3);cprintf( "Eneter Delete Applicant Number: ");
scanf( "%1d ",&anum);
textcolor(128+4);
if(head1==NULL) {gotoxy(12,7);printf( "List Null!) ");goto end; }
p1=head1;
while(anum!=p1-> anum&&p1-> next1!=NULL)
{ p2=p1;p1=p1-> next1;}
if(anum==p1-> anum)
{
if(p1==head1)head1=p1-> next1;
else p2-> next1=p1-> next1;
gotoxy(11,7);
cprintf( "%1d Has Been Deleted! ",anum);
n=n-1;
textcolor(14);
gotoxy(5,12);cprintf( "Save(Y.orN)? ");
c=getch();
if(c== 'Y '|| c== 'y ')save1(head1);
}
else
{
textcolor(128+4);gotoxy(11,7);
cprintf( "%1d Not Been Found! ",anum);
end:textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");getch();
}
}
/*---------------delete job-----------*/
struct job *del2(struct job * head2)
{
struct job * p3, * p4;long jnum;char d;
color();textcolor(14);
gotoxy(7,3);cprintf( "Eneter Delete job Number: ");
scanf( "%1d ",&jnum);
textcolor(128+4);
if(head2==NULL) {gotoxy(12,7);printf( "List Null!) ");goto end; }
p3=head2;
while(jnum!=p3-> jnum&&p3-> next2!=NULL)
{ p4=p3;p3=p3-> next2;}
if(jnum==p3-> jnum)
{
if(p3==head2)head2=p3-> next2;
else p4-> next2=p3-> next2;
gotoxy(11,7);
cprintf( "%1d Has Been Deleted! ",jnum);
k=k-1;
textcolor(14);
gotoxy(5,12);cprintf( "Save(Y.orN)? ");
d=getch();
if(d== 'Y '|| d== 'y ')save2(head2);
}
else
{
textcolor(128+4);gotoxy(11,7);
cprintf( "%1d Not Been Found! ",jnum);
end:textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");getch();
}
}
/*---------------------arrange applicant--------*/
struct applicant *arrange1(struct applicant *head1)
{
int i,j;struct applicant * p5;
p5=head1;
for(i=0;i next1;}
for(j=1;j {
for(i=1;i <=n-j;i++)
if(applcnt[i-1].anum> applcnt[i].anum)
{info1=applcnt[i-1];applcnt[i-1]=applcnt[i];applcnt[i]=info1; }
}
p5=&applcnt[0];
for(i=1;i { p5-> next1=&applcnt[i];p5=p5-> next1;}
p5-> next1=NULL;head1=&applcnt[0];
return(head1);
}
/*-----------------arrange job-------------------*/
struct job *arrange2(struct job *head2)
{
int r,f;struct job * p7;
p7=head2;
for(r=0;r next2;}
for(f=1;f {
for(r=1;r <=k-f;r++)
if(jb[r-1].jnum> jb[r].jnum)
{info2=jb[r-1];jb[r-1]=jb[r];jb[r]=info2; }
}
p7=&jb[0];
for(r=1;r { p7-> next2=&jb[r];p7=p7-> next2;}
p7-> next2=NULL;head2=&jb[0];
return(head2);
}
/*--------------------insert applicant-----------------*/
struct applicant *insert1(struct applicant *head1)
{
struct applicant * p0, * p1, * p2, * applcnt;char c;
color();
applcnt=(struct applicant * )malloc(LEN);
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Num: "); scanf( "%1d ",&applcnt-> anum);
gotoxy(5,7);cprintf( "Enter Name: "); scanf( "%s ",applcnt-> aname);
gotoxy(5,9);cprintf( "Enter Your ID Number: "); scanf( "%s ",applcnt-> id);
gotoxy(5,11);cprintf( "Enter Your Certification: "); scanf( "%s ",applcnt-> cert);
gotoxy(5,13);cprintf( "Enter Your Ideal Job: "); scanf( "%s ",applcnt-> rqurjob);
p1=head1; p0=applcnt;
if(head1=NULL)
{ head1=p0;p0-> next1=NULL;}
else
while((p0-> anum> p1-> anum)&&(p1-> next1!=NULL))
{ p2=p1; p1=p1-> next1;}
if(p0-> anum <=p1-> anum)
{
if(head1==p1)head1=p0;
else p2-> next1=p0; p0-> next1=p1;
}
else {p1-> next1=p0;p0-> next1=NULL;}
n=n+1;
textcolor(14);
gotoxy(5,16);cprintf( "Save(Y.or,N)? ");
c=getch();
if(c== 'Y '||c== 'y ')save1(head1);
head1=load1();
return(head1);
}
/*------------------insert job----------------------*/
struct job *insert2(struct job * head2)
{
struct job * q0, * p3, * p4, * jb;char d;
color();
jb=(struct job *)malloc(LENB);
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Job Num: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Job Number: "); scanf( "%1d ",&jb-> jnum);
gotoxy(5,7);cprintf( "Enter Job Name: "); scanf( "%s ",jb-> jname);
gotoxy(5,9);cprintf( "Enter The Amount Of The Job Needs: "); scanf( "%i ",jb-> need);
p3=head2; q0=jb;
if(head2==NULL)
{ head2=q0;q0-> next2=NULL;}
else
while((q0-> jnum> p3-> jnum)&&(p3-> next2!=NULL))
{ p4=p3; p3=p3-> next2;}
if(q0-> jnum <=p3-> jnum)
{
if(head2==p3)head2=q0;
else p4-> next2=q0; q0-> next2=p3;
}
else { p3-> next2=q0;q0-> next2=NULL;}
k=k+1;
textcolor(14);
gotoxy(5,12);cprintf( "Save(Y.or,N)? ");
d=getch();
if(d== 'Y '||d== 'y ')save2(head2);
head2=load2();
return(head2);
}
/*----------------------load applicant------------------------*/
struct applicant *load1(void)
{
struct applicant *p1, * p2, * head1;
FILE * fp;
color();textcolor(14);
gotoxy(3,5);cprintf( "Please Enter Loaded Applicant File Name: ");
scanf( "%s ",filename1);
fp=fopen( "filename1.dat ", "r ");
fscanf(fp, "%s ",filename1);
fclose(fp);
if((fp=fopen(filename1, "rb "))==NULL)
{
textcolor(128+4);gotoxy(3,4);
cprintf( "Info1. been not found from %s ! ",filename1);
goto end;
}
p2=p1=(struct applicant * )malloc(LEN);
n=0;
while(! feof(fp))
{
n=n+1;if(n==1)head1=p1;
fread(p1,LEN,1,fp);
p2=p1;
p1=(struct applicant * )malloc(LEN);
p2-> next1=p1;
}
fclose(fp);
n=n-1;
p2-> next1=NULL;
for(p1=head1;p1-> next1-> next1!=NULL;p1=p1-> next1);
p1-> next1=NULL;
clrscr(); textcolor(128+4);
gotoxy(3,5);cprintf( "Info1 Has Been Loaded from %s! ",filename1);
end:textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");
getch();
return(head1);
}
/*--------------load job-------------------*/
struct job *load2(void)
{
struct job * p3, * p4, * head2;
FILE *fp;
color();textcolor(14);
gotoxy(3,5);cprintf( "Please Enter Loaded Job File Name: ");
scanf( "%s ",filename2);
fp=fopen( "filename2.dat ", "r ");
fscanf(fp, "%s ",filename2);
fclose(fp);
if((fp=fopen(filename2, "rb "))==NULL)
{
textcolor(128+4);gotoxy(3,4);
cprintf( "Info2. been not found from %s ! ",filename2);
goto end;
}
p4=p3=(struct job * )malloc(LENB);
k=0;
while(! feof(fp))
{
k=k+1;if(k==1)head2=p3;
fread(p3,LENB,1,fp);
p4=p3;
p3=(struct job * )malloc(LENB);
p4-> next2=p3;
}
fclose(fp);
k=k-1;
p4-> next2=NULL;
for(p3=head2;p3-> next2-> next2!=NULL;p3=p3-> next2);
p3-> next2=NULL;
clrscr(); textcolor(128+4);
gotoxy(3,5);cprintf( "Info2 Has Been Loaded From %s! ",filename2);
end:textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");
getch();
return(head2);
}
/*---------------------save applicant------------------------*/
save1(struct applicant * head1)
{
FILE * fp; struct applicant * p5;
color();textcolor(14);
p5=head1;
gotoxy(3,5);cprintf( "Please Enter Saved Applicant File Name: ");
scanf( "%s ",filename1);
fp=fopen( "filename1.dat ", "w ");
fprintf(fp, "%s ",filename1);
fclose(fp);
fp=fopen(filename1, "wb ");
while(p5=NULL){ fwrite(p5,LEN,1,fp);p5=p5-> next1;}
fclose(fp);
textcolor(128+4);clrscr();
gotoxy(2,3);
cprintf( "%d Applicant Record Has Been Saved To %s ! ",n,filename1);
textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");getch();
}
/*------------------save job------------------------*/
save2(struct job * head2)
{
FILE * fp; struct job * p7;
color();textcolor(14);
p7=head2;
gotoxy(3,5);cprintf( "Pleas Enter Saved Job File Name: ");
scanf( "%s ",filename2);
fp=fopen( "filename2.dat ", "w ");
fprintf(fp, "%s ",filename2);
fclose(fp);
fp=fopen(filename2, "wb ");
while(p7=NULL){ fwrite(p7,LENB,1,fp);p7=p7-> next2;}
fclose(fp);
textcolor(128+4);clrscr();
gotoxy(2,3);
cprintf( "%d Job Record Has Been Saved To %s ! ",k,filename2);
textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");getch();
}
/*------------------------main-------------------------*/
main()
{
char m,c;
struct applicant * head1;
struct job * head2;
textmode(7);textmode(3); textbackground(11);
color();textcolor(14);
gotoxy(12,5);cprintf( "Welcome To Use ");
textcolor(14);
gotoxy(7,7);cprintf( "Intermediary Information Management System ");
gotoxy(12,9);cprintf( "Written By Aaron Harvey ");
textcolor(128+11); gotoxy(2,14);
cprintf( " Any Key Continue! ESC to exit ");
c=getch();
if(ESC==c)exit(0);
menu:
m=menu();
switch(m)
{
case '1 ':head1=create1(); break;
case '2 ':print1(head1); break;
case '3 ':head1=del1(head1); break;
case '4 ':head1=insert1(head1); break;
case '5 ':head1=load1(); break;
case '6 ':head2=create2(); break;
case '7 ':print2(head2); break;
case '8 ':head2=del2(head2); break;
case '9 ':head2=insert2(head2); break;
case '10 ':head2=load2(); break;
case '0 ':textmode(11); exit(0);
}
goto menu;
}

回答2:

所以这位同学,求到代码了吗?求到能给我一份吗?😂

回答3:

你好!!!c语言房屋中介系统源代码 可以给我一份吗?这周六要交。。。。请发于1271886239@qq.com感激不尽!!!

回答4:

建议你去百度或GOOGLE搜索一下,看看有没有相关的信息或资料可以帮你。