问题描述
- VC++运行出现错误,但应该可以的啊···
-
#include
#include
#include
#definr N 3
using namespace std;
struct Worker
{string num;
string name;
int base;
int overtimepay;
int prize;
int takeout;
int realpay;
};
void inputfile(ofstream &outData)//输入数据
{
struct Worker a:
cout<<"输入编号:"; cin>>a.num;
cout<<"输入姓名:"; cin>>a.name;
cout<<"输入基本工资:"; cin>>a.base;
cout<<"输入加班工资:"; cin>>a.overtimepay;
cout<<"输入奖金:"; cin>>a.prize;
cout<<"输入扣除:"; cin>>a.takeout;
a.realpay=a.base+a.overcomepay+a.prize_a.takeout;
outData<
}
void print(ifstream &inData)//输出数据
{
struct worker b;
cout
while(!indata.eof())//从文件中读数据,直到遇到文件结束
{ inData>>b.num>>b.name>>b.base>>b.overtimepay>>b.prize>>b.takeout>>b.realpay;
cout<<<b.num<<setw(4)<<b.name<<setw(4)<<b.base<<setw(4)<<b.overtimepay<<setw(4)<<b.prize<<setw(4)<<b.takeout<<setw(4)<<b.realpay<<endl;}
}
void main()
{
int i;
ifstream inData;//输入数据
ofstream outData;//
outData.open("E:Salary.txt");//打开文件
for(i=1;i<=N;i++)
{
inputfile(outData);
}
outData.close();
inData.open("E:Salary.txt");
print(inData);
inData.close();
}
结果:--------------------Configuration: ff - Win32 Debug--------------------
Compiling...
Command line warning D4028 : minimal rebuild failure, reverting to normal build
ff.cpp
i:c++ff.cpp(0) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file '.pdbmgr.cpp', line 113)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.ff.exe - 1 error(s), 1 warning(s)
解决方案
具体的错误是什么?是运行过程中程序崩溃了吗?还是其他的,出错的代码是哪一行?不要上来就发全部代码,只发关键的错误代码就行了
解决方案二:
冯·诺伊曼
解决方案三:
好像vc++运行不了所有c++程序。。。
解决方案四:
void main()函数没有参数,你加个参数试试
int main(int argc, char* argv[])
时间: 2024-07-31 04:24:18