C++课程设计 房屋交易系统.docx

上传人:b****7 文档编号:9267271 上传时间:2023-02-03 格式:DOCX 页数:29 大小:20.68KB
下载 相关 举报
C++课程设计 房屋交易系统.docx_第1页
第1页 / 共29页
C++课程设计 房屋交易系统.docx_第2页
第2页 / 共29页
C++课程设计 房屋交易系统.docx_第3页
第3页 / 共29页
C++课程设计 房屋交易系统.docx_第4页
第4页 / 共29页
C++课程设计 房屋交易系统.docx_第5页
第5页 / 共29页
点击查看更多>>
下载资源
资源描述

C++课程设计 房屋交易系统.docx

《C++课程设计 房屋交易系统.docx》由会员分享,可在线阅读,更多相关《C++课程设计 房屋交易系统.docx(29页珍藏版)》请在冰豆网上搜索。

C++课程设计 房屋交易系统.docx

C++课程设计房屋交易系统

#defineNULL0

#include

#include

#include

#include

#include

//定¡§义°?

house类¤¨¤

classhouse

{

public:

house*next;

char*Getadd(){returnadd;}

char*Getstyle(){returnstyle;}

intGetarea(){returnarea;}

intGetprice(){returnprice;}

intGethouseage(){returnhouseage;}

char*Getstate(){returnstate;}

voidset_information(char*Nadd,char*Nstyle,intNarea,intNprice,intNhouseage,char*Nstate)

{

strcpy(add,Nadd);

strcpy(style,Nstyle);

area=Narea;

price=Nprice;

houseage=Nhouseage;

strcpy(state,Nstate);

}

private:

charadd[40];

charstyle[10];

intarea;

intprice;

inthouseage;

charstate[10];

};

//定¡§义°?

用®?

户¡ì类¤¨¤

classuser

{

public:

user*next;

char*Getname(){returnname;}

intGetID(){returnID;}

intGetpassword(){returnpassword;}

voidset_information(char*Nname,intid,intpasscode)

{

strcpy(name,Nname);

ID=id;

password=passcode;

}

private:

charname[20];

intID;

intpassword;

};

//定¡§义°?

管¨¹理¤¨ª员¡À类¤¨¤

classmanager

{

public:

manager*next;

char*Getname(){returnname;}

intGetID(){returnID;}

intGetpassword(){returnpassword;}

voidset_information(char*Nname,intid,intpasscode)

{

strcpy(name,Nname);

ID=id;

password=passcode;

}

private:

charname[20];

intID;

intpassword;

};

 

//按ã¡ä地Ì?

址¡¤查¨¦询¡¥房¤?

屋Y的Ì?

信?

息¡é

voidsearch_house()

{

charch[40];

intsum=0;

house*head,*q,*p=newhouse;

head=p;

charadd[40];

charstyle[10];

intarea;

intprice;

inthouseage;

charstate[10];

ifstreamfile("D:

\\house_information.txt");

do

{

cout<<"请?

输º?

入¨?

您¨²要°a查¨¦找¨°的Ì?

房¤?

屋Y地Ì?

址¡¤:

";

cin>>ch;

file>>add>>style>>area>>price>>houseage>>state;

p->set_information(add,style,area,price,houseage,state);

q=p;

while(!

file.eof())

{

p=newhouse;

file>>add>>style>>area>>price>>houseage>>state;

p->set_information(add,style,area,price,houseage,state);

q->next=p;

q=p;

}

q->next=NULL;

file.close();

p=head;

while(p!

=NULL)

{

if(strcmp(p->Getadd(),ch)==0)

sum++;

p=p->next;

}

if(sum==0)

cout<<"对?

不?

起e,ê?

信?

息¡é库a中D没?

有®D与®?

您¨²输º?

入¨?

的Ì?

房¤?

屋Y地Ì?

址¡¤匹£¤配?

的Ì?

房¤?

屋Y信?

息¡é!

ê?

请?

重?

新?

输º?

入¨?

…-…-"<

else

{

p=head;

while(p!

=NULL)

{

if(strcmp(p->Getadd(),ch)==0)

{

cout<

址¡¤"<

积y"<

格?

"<

龄¢?

"<

"<

cout<Getadd()<Getstyle()<Getarea()<Getprice()<Gethouseage()<Getstate()<

}

p=p->next;

}

}

}while(sum==0);

}

//删¦?

除y房¤?

屋Y信?

息¡é

voiddelete_house()

{

charch[40];

house*head,*q,*p=newhouse;

head=p;

charadd[40];

charstyle[10];

intarea;

intprice;

inthouseage;

charstate[10];

intsum=0;

ifstreamfile1("D:

\\house_information.txt");

do

{

cout<<"请?

输º?

入¨?

您¨²要°a删¦?

除y的Ì?

房¤?

屋Y地Ì?

址¡¤:

";

cin>>ch;

file1>>add>>style>>area>>price>>houseage>>state;

p->set_information(add,style,area,price,houseage,state);

q=p;

while(!

file1.eof())

{

p=newhouse;

file1>>add>>style>>area>>price>>houseage>>state;

p->set_information(add,style,area,price,houseage,state);

q->next=p;

q=p;

}

q->next=NULL;

file1.close();

p=head;

while(p!

=NULL)

{

if(strcmp(p->Getadd(),ch)==0)

{

q->next=p->next;

deletep;

sum++;

}

p=p->next;

}

if(sum==0)

cout<<"对?

不?

起e,ê?

信?

息¡é库a中D没?

有®D与®?

您¨²输º?

入¨?

的Ì?

房¤?

屋Y地Ì?

址¡¤匹£¤配?

的Ì?

房¤?

屋Y信?

息¡é!

ê?

请?

重?

新?

输º?

入¨?

…-…-"<

else

{

ofstreamfile2("D:

\\house_information.txt");

p=head;

while(p!

=NULL)

{

file2<Getadd()<<"\t"<Getstyle()<<"\t"<Getarea()<<"\t"<Getprice()<<"\t"<Gethouseage()<<"\t"<Getstate()<<"\n";

p=p->next;

}

q->next=NULL;

file2.close();

}

}while(sum==0);

}

//增?

加¨®一°?

条¬?

新?

的Ì?

房¤?

屋Y信?

息¡é

voidadd_house()

{

charadd[40];

charstyle[10];

intarea;

intprice;

inthouseage;

charstate[10];

cout<<"请?

输º?

入¨?

你?

想?

添¬¨ª加¨®的Ì?

房¤?

屋Y信?

息¡é:

êo\n";

cin>>add>>style>>area>>price>>houseage>>state;

ofstreamfile("D:

\\house_information.txt",ios:

:

app);

file<<"\n"<

file.close();

}

//修T改?

房¤?

屋Y信?

息¡é

voidmodify_house()

{

charch[40];

intsum=0;

do

{

cout<<"请?

输º?

入¨?

您¨²想?

要°a修T改?

的Ì?

房¤?

屋Y信?

息¡é的Ì?

房¤?

屋Y地Ì?

址¡¤:

êo";

cin>>ch;

house*head,*q,*p=newhouse;

head=p;

charadd[40];

charstyle[10];

intarea;

intprice;

inthouseage;

charstate[10];

intsum=0;

ifstreamfile1("D:

\\house_information.txt");

file1>>add>>style>>area>>price>>houseage>>state;

p->set_information(add,style,area,price,houseage,state);

q=p;

while(!

file1.eof())

{

p=newhouse;

file1>>add>>style>>area>>price>>houseage>>state;

p->set_information(add,style,area,price,houseage,state);

q->next=p;

q=p;

}

q->next=NULL;

file1.close();

p=head;

while(p!

=NULL)

{

if(strcmp(p->Getadd(),ch)==0)

{

strcpy(add,p->Getadd());

strcpy(style,p->Getstyle());

area=p->Getarea();

price=p->Getprice();

houseage=p->Gethouseage();

strcpy(state,p->Getstate());

charchoice;

do

{

cout<<"请?

输º?

入¨?

您¨²想?

要°a修T改?

的Ì?

信?

息¡é:

êo\n";

cout<<"A:

价?

格?

B:

房¤?

龄¢?

C:

状Á¡ä态¬?

\n";

cin>>choice;

switch(choice)

{

case'a':

case'A':

cout<<"请?

输º?

入¨?

新?

的Ì?

价?

格?

êo";cin>>price;break;

case'b':

case'B':

cout<<"请?

输º?

入¨?

新?

的Ì?

房¤?

龄¢?

êo";cin>>houseage;break;

case'c':

case'C':

cout<<"请?

输º?

入¨?

新?

的Ì?

状Á¡ä态¬?

êo";cin>>state;break;

default:

cout<<"对?

不?

起e,ê?

您¨²输º?

入¨?

的Ì?

指?

令¢?

不?

正y确¨¡¤!

ê?

请?

重?

新?

输º?

入¨?

…-…-"<

}

}while(choice!

='A'||choice!

='a'||choice!

='B'||choice!

='b'||choice!

='C'||choice!

='c');

p->set_information(add,style,area,price,houseage,state);

sum++;

p=p->next;

}

}

if(sum==0)

cout<<"对?

不?

起e,ê?

信?

息¡é库a中D没?

有®D与®?

您¨²输º?

入¨?

的Ì?

房¤?

屋Y地Ì?

址¡¤匹£¤配?

的Ì?

房¤?

屋Y信?

息¡é!

ê?

请?

重?

新?

输º?

入¨?

…-…-"<

else

{

ofstreamfile2("D:

\\house_information.txt");

p=head;

while(p!

=NULL)

{

file2<Getadd()<<"\t"<Getstyle()<<"\t"<Getarea()<<"\t"<Getprice()<<"\t"<Gethouseage()<<"\t"<Getstate()<<"\n";

p=p->next;

}

q->next=NULL;

file2.close();

}

}while(sum==0);

}

//按ã¡ä用®?

户¡ì姓?

名?

查¨¦询¡¥用®?

户¡ì信?

息¡é

voidsearch_user()

{

charch[40];

intsum=0;

user*head,*q,*p=newuser;

head=p;

charname[20];

intID;

intpassword;

ifstreamfile("D:

\\user_information.txt");

do

{

cout<<"请?

输º?

入¨?

您¨²要°a查¨¦询¡¥的Ì?

用®?

户¡ì姓?

名?

:

";

cin>>ch;

file>>name>>ID>>password;

p->set_information(name,ID,password);

q=p;

while(!

file.eof())

{

p=newuser;

file>>name>>ID;

p->set_information(name,ID,password);

q->next=p;

q=p;

}

q->next=NULL;

file.close();

p=head;

while(p!

=NULL)

{

if(strcmp(p->Getname(),ch)==0)

sum++;

p=p->next;

}

if(sum==0)

cout<<"对?

不?

起e,ê?

信?

息¡é库a没?

有®D与®?

您¨²输º?

入¨?

的Ì?

用®?

户¡ì姓?

名?

匹£¤配?

的Ì?

用®?

户¡ì信?

息¡é!

ê?

请?

重?

新?

输º?

入¨?

…-…-"<

else

{

p=head;

while(p!

=NULL)

{

if(strcmp(p->Getname(),ch)==0)

{

cout<

名?

"<

cout<Getname()<GetID()<

}

p=p->next;

}

}

}while(sum==0);

}

//删¦?

除y用®?

户¡ì信?

息¡é

voiddelete_user()

{

charch[40];

intsum=0;

user*head,*q,*p=newuser;

head=p;

charname[20];

intID;

intpassword;

ifstreamfile("D:

\\user_information.txt");

do

{

cout<<"请?

输º?

入¨?

您¨²要°a删¦?

除y的Ì?

用®?

户¡ì姓?

名?

:

";

cin>>ch;

file>>name>>ID>>password;

p->set_information(name,ID,password);

q=p;

while(!

file.eof())

{

p=newuser;

file>>name>>ID>>password;

p->set_information(name,ID,password);

q->next=p;

q=p;

}

q->next=NULL;

file.close();

while(p!

=NULL)

{

if(strcmp(p->Getname(),ch)==0)

{

sum++;

q->next=p->next;

deletep;

}

p=p->next;

}

if(sum==0)

cout<<"对?

不?

起e,ê?

信?

息¡é库a中D没?

有®D与®?

您¨²输º?

入¨?

的Ì?

用®?

户¡ì姓?

名?

匹£¤配?

的Ì?

用®?

户¡ì信?

息¡é!

ê?

请?

重?

新?

输º?

入¨?

…-…-"<

else

{

ofstreamfile2("D:

\\house_information.txt");

p=head;

while(p!

=NULL)

{

file2<<"\t"<Getname()<<"\t"<GetID()<<"\t"<Getpassword()<<"\n";

p=p->next;

}

q->next=NULL;

file2.close();

}

}while(sum==0);

}

//增?

加¨®一°?

条¬?

新?

的Ì?

用®?

户¡ì信?

息¡é

voidadd_user()

{

charname[20];

intID;

intpassword;

cout<<"请?

输º?

入¨?

您¨²想?

要°a添¬¨ª加¨®的Ì?

用®?

户¡ì信?

息¡é:

êo\n";

cin>>name>>ID>>password;

ofstreamfile("D:

\\user_information.txt",ios:

:

app);

file<<"\n"<

file.close();

}

//修T改?

用®?

户¡ì信?

息¡é

voidmodify_user()

{

charch[40];

intsum=0;

do

{

cout<<"请?

输º?

入¨?

您¨²想?

要°a修T改?

的Ì?

用®?

户¡ì信?

息¡é的Ì?

用®?

户¡ì姓?

名?

êo";

cin>>ch;

user*head,*q,*p=newuser;

head=p;

charname[40];

intID;

intpassword;

ifstreamfile1("D:

\\user_information.txt");

file1>>name>>ID>>password;

p->set_information(name,ID,password);

q=p;

while(!

file1.eof())

{

p=newuser;

file1>>name>>ID>>password;

p->set_information(name,ID,password);

q->next=p;

q=p;

}

q->next=NULL;

file1.close();

p=head;

while(p!

=NULL)

{

if(strcmp(p->Getname(),ch)==0)

{

strcpy(name,p->Getname());

ID=p->GetID();

password=p->Getpassword();

charchoice;

intpasscode;

do

{

cout<<"请?

输º?

入¨?

您¨²想?

要°a修T改?

的Ì?

信?

息¡é:

êo\n";

cout<<"A:

用®?

户¡ì姓?

名?

B:

密¨¹码?

\n";

cin>>choice;

switch(choice)

{

case'a':

case'A':

cout<<"请?

输º?

入¨?

新?

的Ì?

用®?

户¡ì姓?

名?

êo";cin>>name;break;

case'b':

case'B':

do

{

cout<<"请?

输º?

入¨?

新?

的Ì?

密¨¹码?

êo";

cin>>password;

cout<<"请?

再¨´输º?

入¨?

一°?

次ä?

êo";

cin>>passcode;

if(password==passcode)

cout<<"密¨¹码?

设¦¨¨置?

成¨¦功|!

ê?

"<

else

cout<<"输º?

入¨?

的Ì?

密¨¹码?

不?

一°?

致?

ê?

请?

重?

新?

输º?

入¨?

…-…-"<

}

while(password!

=passcode);

break;

default:

cout<<"对?

不?

起e,ê?

您¨²输º?

入¨?

的Ì?

指?

令¢?

不?

正y确¨¡¤

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 工作计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1