C++ exe 无法执行
来源:百度知道 编辑:UC知道 时间:2024/06/07 04:47:17
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
for(;;)
{ int choice;
cout<<"输入1增加记录,2看总消费总额,结束请输入3:"<<endl;
cin>>choice;
cout<<endl;
if(choice==1)
{ fstream f("noyeya.txt");
float money;
char ch1;
cout<<"请输入消费金额:";
cin>>money;
cout<<"你输入的是"<<money<<" "<<" 确定请输入y"<<endl;
cin>>ch1;
if(ch1=='y')
{f.seekg (0,ios::end);
f<<money<<endl;
}
else
cout<<" Mistake!!!!!!!!"<<endl;
f.close();
}
else if(choice==2)
{ char aaa[10];
float sum=0,c
#include<fstream>
using namespace std;
int main()
{
for(;;)
{ int choice;
cout<<"输入1增加记录,2看总消费总额,结束请输入3:"<<endl;
cin>>choice;
cout<<endl;
if(choice==1)
{ fstream f("noyeya.txt");
float money;
char ch1;
cout<<"请输入消费金额:";
cin>>money;
cout<<"你输入的是"<<money<<" "<<" 确定请输入y"<<endl;
cin>>ch1;
if(ch1=='y')
{f.seekg (0,ios::end);
f<<money<<endl;
}
else
cout<<" Mistake!!!!!!!!"<<endl;
f.close();
}
else if(choice==2)
{ char aaa[10];
float sum=0,c
运行了下 似乎没有问题 exe也试过了 也是没有问题的
编译器只要不在调试下 应该就是调用的exe
难道是其他程序影响的?
for(;;) 这句for条件写的ms有问题,看得出,你是想让它做个死循环,不妨把for(;;) 改成while(1)再试试看
可能编译出错