out<<H5;
flag = false;
}
if (flag)
{
cout <<endl <<"系统中没有管理员信息!!!!!" <<endl <<endl;
}
else
{
cout <<endl <<"所有管理员信息已经全部显示出来!!!!!" <<endl <<endl;
}
system("pause");
}
//修改信息
void machine::alter()
{
ofstream outData("e:\\temp.txt", ios::out);
ifstream inData("e:\\pbook.txt", ios::in);
if (!inData)
{
cout <<endl <<"对不起!!!!找不到文件!!!!" <<endl;
system("pause");
return;
}
string sign;
cout <<endl <<"你要修改设备的编号 :";
cin >>sign;
bool flag = true;
string str;
while (inData>>num)
{
getline(inData, str);
if (sign==num)
{
cout <<endl <<"你想修改的设备信息:" <<endl <<endl;
cout<<H<<H1<<H2;
cout<<setw(10)<<num<<str<<endl;
cout<<H2;
cout <<endl <<"请根据下面提示修改信息 : " <<endl;
cout<<"编号 : " ;
cin >>num;
cout <<"类别 : ";
cin >>category;
cout <<"名称 : ";
cin >>name;
cout <<"价格 : ";
cin >>price;
cout <<"库存数量 : ";
cin >>quantity;
save_new();
flag = false;
break;
}
outData<<setiosflags(ios::left)<<num<<setw(10)<<str<<endl;
}
if (flag)
{
cout <<endl <<"对不起!!!没有找到这个设备!!!!" <<endl <<endl;
}
else
{
while(getline(inData, str))
{
outData <<str <<endl;
}
outData.close();
inData.close();
ofstream out("e:\\pbook.txt", ios::out);
ifstream in("e:\\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");
}
void vip::alter()
{
ofstream outData("e:\\temp1.txt", ios::out);
ifstream inData("e:\\Document.txt", ios::in);
if (!inData)
{
cout <<endl <<"对不起!!!!找不到文件!!!!" <<endl;
system("pause");
return;
}
string sign;
cout <<endl <<"你要修改管理员的帐号 :";
cin >>sign;
bool flag = true;
string str;
while (inData>>id)
{
getline(inData, str);
if (sign==id)
{
cout <<endl <<"你想修改的管理员信息:" <<endl <<endl;
cout<<H3<<H4<<H5;
cout<<setw(10)<<id<<str<<endl;
cout<<H5;
cout <<endl <<"请根据下面提示修改信息 : " <<endl;
cout<<"帐号 : " ;
cin >>id;
cout <<"密码 : ";
cin >>password;
save_new();
flag = false;
break;
}
outData<<setiosflags(ios::left)<<id<<setw(10)<<str<<endl;
}
if (flag)
{
cout <<endl <<"对不起!!!没有找到这个管理员信息!!!!" <<endl <<endl;
}
else
{
while(getline(inData, str))
{
outData <<str <<endl;
}
outData.close();
inData.close();
ofstream out("e:\\Document.txt", ios::out);
i |