永发信息网

麻烦高手注释

答案:1  悬赏:60  手机版
解决时间 2021-07-21 12:00

麻烦高手注释下面没注释的代码,谢谢
using namespace std;
class book
{
public:
book::book()
{
name = "\0"; //给初值
address = "\0";
number = "\0";
post = "\0";
qq = "\0";
}

//首页
char book::inter_face()
{
system("cls");

cout <<endl;
<<endl


char choose;
cin >>choose;
fflush(stdin);

return choose;
}



{
cout <<endl <<"根据下面提示输入新联系人信息" <<endl <<endl
<<"姓名 :" ;
cin >>name;
fflush(stdin);
cout <<"电话 : ";
cin >>number;
fflush(stdin);
cout <<"QQ : ";
cin >>qq;
fflush(stdin);
cout <<"邮编 : ";
cin >>post;
fflush(stdin);
cout <<"地址 : ";
cin >>address;
fflush(stdin);

save_new();

cout <<endl <<endl <<"新联系人信息已经保存好!!!!!" <<endl <<endl;
system("pause");
}



{
ofstream outData("temp.txt", ios::out);
ifstream inData("pbook.txt", ios::in); //
if (!outData || !inData)
{
cout <<endl <<"对不起!!!!找不到文件!!!!" <<endl;
system("pause");
return;
}

string sign;
cout <<endl <<"你要删除输入姓名或电话号 :";
cin >>sign;
string str1;
bool flag = true;
string str;

while (inData >>name >>number)
{
getline(inData, str);

if ((sign==name) || (sign==number))
{
cout <<endl <<"你想删除的联系人:" <<endl <<endl;
cout <<str1 <<endl;
cout <<setiosflags(ios::left) <<setw(17) <<name
<<" " <<number <<str <<endl;
flag = false;
break;
}

outData <<setiosflags(ios::left) <<setw(17) <<name
<<" " <<number <<str <<endl;
}

if (flag)
{
cout <<endl <<"对不起!!!联系人中没你找的人!!!!" <<endl <<endl;
}
else
{
while (getline(inData, str))
{
outData <<str <<endl;
}

outData.close();
inData.close();

ofstream out("pbook.txt", ios::out);
ifstream in("temp.txt", ios::in);

if (!out || !in)
{
cout <<endl <<"对不起不能打开文件!!!" <<endl <<endl;
system("pause");
return;
}

while (getline(in, str))
{
out <<str <<endl;
}

out.close();//
in.close();
cout <<endl <<"这个人的信息已经从你的通迅录中删除!!!" <<endl <<endl;
}

system("pause");
}


{
ifstream inData("pbook.txt",ios::in);


if (!inData)
{
cout <<endl <<"对不起!!!!没有找到文件!!!!!" <<endl;
system("pause");
return;
}

bool flag = true;
string record;

while (getline(inData, record))
{
if (flag)
{
cout <<endl <<"所有联系人信息如下: "<<endl;
}
cout <<record <<endl;
flag = false;
}

if (flag)
{
cout <<endl <<"你的通迅录中没有联系人!!!!!" <<endl <<endl;
}
else
{
cout <<endl <<"所有联系人已经全部显示出来!!!!!" <<endl <<endl;
}

system("pause");
}


{
ofstream outData("temp.txt", ios::out);
ifstream inData("pbook.txt", ios::in); //
if (!outData || !inData)
{
cout <<endl <<"对不起!!!!找不到文件!!!!" <<endl;
system("pause");
return;
}

string sign;
cout <<endl <<"你要修改输入姓名或电话号 :";
cin >>sign;
string str1;
bool flag = true;
string str;

while (inData >>name >>number)
{
getline(inData, str);

if ((sign==name) || (sign==number))
{
cout <<endl <<"你想修改的联系人:" <<endl <<endl;
cout <<str1 <<endl;
cout <<setiosflags(ios::left) <<setw(17) <<name
<<" " <<number <<str <<endl;
cout <<endl <<"请根据下面提示修改信息 : " <<endl;
cout <<"姓名 :" ;
cin >>name;
fflush(stdin);
cout <<"电话号:";
cin >>number;
fflush(stdin);
cout <<"QQ :";
cin >>qq;
fflush(stdin);
cout <<"邮编 :";
cin >>post;
fflush(stdin);
cout <<"地址 :";
cin >>address;
fflush(stdin);
save_new();
flag = false;
break;
}

outData <<setiosflags(ios::left) <<setw(17) <<name
<<" " <<number <<str <<endl;
}

if (flag)
{
cout <<endl <<"对不起!!!联系人中没你找的人!!!!" <<endl <<endl;
}
else
{
while (getline(inData, str))
{
outData <<str <<endl;
}

outData.close();
inData.close();

ofstream out("pbook.txt", ios::out);
ifstream in("temp.txt", ios::in);

if (!out || !in)
{
cout <<endl <<"对不起不能打开文件!!!" <<endl <<endl;
system("pause");
return;
}

while (getline(in, str))
{
out <<str <<endl;
}

out.close();
in.close();
cout <<endl <<"这个人的信息已经在你的通迅录中修改!!!" <<endl <<endl;
}

system("pause");
}



{
ifstream inData("pbook.txt",ios::in);

if (!inData)
{
cout <<endl <<"对不起!!!!文件找不到!!!!" <<endl;
system("pause");
return;
}

string sign;
cout <<endl <<"输入你想查找的联系人的姓名或电话号码: ";
cin >>sign;
fflush(stdin);

string str1;
bool flag = true;

string str;
while (inData >>name >>number)
{
getline(inData, str);

if ((name==sign) || (number==sign))
{
cout <<endl <<"你要查找的联系人是: " <<endl <<endl;
cout <<str1 <<endl;
cout <<setiosflags(ios::left) <<setw(17) <<name
<<number <<str <<endl;
flag = false;
system("pause");
break;
}
}
}
void book::save_new()
{
ofstream outData("pbook.txt", ios::app);

if (!outData)
{
cout <<endl <<"对不起!!!打开文件失败!!!!" <<endl <<endl;
system("pause");
return;
}

outData << setiosflags(ios::left) << setw(17) << name
<<" " << setw(16) << number <<" "
<< setw(18) << qq <<" "
<< setw(14) << post <<" "
<< setw(20) << address <<endl;

outData.close();
}
enum power{ADD = '1', DEL = '2', SHOW = '3', Alter = '4', Select = '5', END = '6'};

int main()
{
char choose;
book abj;

while (choose = abj.inter_face())
{
switch (choose)
{
case ADD:
exit(0);
break;
default:
break;
}
}
return 0;
}

最佳答案
你好哦楼主~
很高兴看到你的问题。
但是又很遗憾到现在还没有人回答你的问题。也可能你现在已经在别的地方找到了答案,那就得恭喜你啦。
对于你的问题我爱莫能助!
可能是你问的问题有些专业了,或者别人没有遇到或者接触过你的问题,所以帮不了你。建议你去问题的相关论坛去求助,那里的人通常比较多,也会比较热心,能快点帮你解决问题。
快过年了,
最后祝您全家幸福健康快乐每一天!
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
我有一个兄弟复印机 出现这种情况了 Back Cov
拍拍装修哪个会
荷塘区株洲日丰管地址是什么,有没有知道的
SJ的队长为什么不是韩庚?
朴春You And I罗马歌词
前面带有铃声的英文DJ舞曲有那些。要好听的
十字绣成品回收的地址
带有问号的句子有哪些,描写问号的句子有那些
新宁县邵阳新宁县农业局地址在哪里啊
福田欧曼9系09智能版半挂车配备的发动机是?
可不可以在淘宝上注册两个会员?
天龙八部3级血精石加多少血上限?
发型师来看看
大话畜牧的灵鹿为什么才能养4只?
从网上下载的挂一般都存在哪?
推荐资讯
宠物狗可以带上高铁吗,宠物狗做高铁可以吗?
最悲伤的歌?
公辣椒和母辣椒 哪个比较辣 怎么区别?
任我家族进入方法谁知道?
博爱县焦作伊赛牛肉(团结路)地址在哪,我要去
深圳龙华汽车站到咸宁温泉的汽车有没有阿?急
新中国成立中国的人口是多少?
云梦县孝感梦泽烧烤地址在什么地方,想今天过
安徽2区锦鳞上衣多少钱
婴儿的大便绿色的是正常的吗?
化油器汽车怎么节油
如何提高移动WLAN上网速度
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?