+ -
当前位置:首页 → 问答吧 → C++打开文件出错,求助!

C++打开文件出错,求助!

时间:2011-12-05

来源:互联网

void add(void)
{
int go;
string str1,str2;
do
{
cout<<"请输入要添加的联系人名字: ";
cin>>str1;

cout<<"请输入要添加的联系人号码: ";
cin>>str2;

Infor *person = new Infor(str1,str2);
book.push_back(*person);

0fstream outfile;
outfile.open("text.txt",ios::app);
if(! outfile)
{
cout<<"打开文件失败。";
}
else
outfile<<person;

outfile.close();

cout<<"是否继续添加联系人?(输入1继续,其他退出)" ;
cin>>go;

}while(go == 1);
}

作者: xihojerry   发布时间: 2011-12-05

已经解决。。。是我自己弄错了。。。

作者: xihojerry   发布时间: 2011-12-05

lz真逗。。。。。。。

作者: Qyee16   发布时间: 2011-12-05

呵呵,下次可以多想想哦!

作者: y1509713911   发布时间: 2011-12-05

楼主加油哦~

作者: luminos   发布时间: 2011-12-05

那就散分吧哈哈

作者: a707000646   发布时间: 2011-12-05