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);
}
{
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
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28