有关C++调试的问题

nik_117 2005-12-27 09:28:02
我在调试C++时,它总说:C:\fz117\fz117.cpp(493):fatal error c1004:
unexpected end of file found error executing c1.exe.
整个代码才492,493行没内容呀!
代码在下面,请看看
谢谢(我还没输完):
// fz117a.cpp : Defines the entry point for the console application.

中间省了
void main()
{
Toolpackage tool1;
int a[40],b[40];
int *x,*y,*z;
int m,temp,p;
float bestanswer,answer1,answer2;
bestanswer=1000000000;
for(short d=0;d<O;d++)
{


for(short i=0;i<N;i++)a[i]=tool1.rand4(7);
for(short i=0;i<N;i++)b[i]=toll1.rand4(7);
x=a;
y=b;
answer1=tool1.caculatecost(x);
answer2=tool1.caculatecost(y);
if(answer1==-1.0||answer2==-1.0)
{
while(answer1==-1.0)
{
for(short i=0;i<N;i++)a[i]=tool1.rand4(7);
x=a;
answer1=tool1.caculatecost(x);
}
while(answer2==-1.0)
{
for(short i=0;i<N;i++)b[i]=tool1.rand4(7);
y=b;
answer2=tool1.caculatecost(y);
}
}
for(short i=0;i<M;i++)
{
for(short j=0;j<3;j++)
{
m=tool1.rand4(40);
temp=a[m];
a[m]=b[m];
b[m]=temp;
}
x=a;
y=b;
answer1=tool1.caculatecost(x);
while(answer1==-1.0)
{
for(short i=0;i<N;i++)a[i]=tool1.rand4(7);
x=a;
answer1=tool1.caculatecost(x);
}
if(answer1<bestanswer)
{
bestanswer=answer1;
z=a;
}
answer2=tool1.caculatecost(y);
while(answer2==-1.0)
{
for(short i=0;i<N;i++)b[i]=tool1.rand4(7);
y=b;
answer2=tool1.caculatecost(y);
}
if(answer2<bestanswer)
{
bestanswer=answer2;
z=b;
}
}
}

for(short i=1;i<N+1;i++)
{
cout<<i<<"\t"<<*(z+i-1)<<endl;
}
}
...全文
194 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
nik_117 2006-01-01
  • 打赏
  • 举报
回复
怎么结帖给分呀,我还不会呢
nik_117 2005-12-30
  • 打赏
  • 举报
回复
问题解决了
谢谢!
csucdl 2005-12-30
  • 打赏
  • 举报
回复
A_B_C_ABC说的是
0黄瓜0 2005-12-30
  • 打赏
  • 举报
回复
光说解决了,又不表示一下。就算这里的人都没有帮到你,你也应结帖-给分。
csucdl 2005-12-27
  • 打赏
  • 举报
回复
在你的文件开始处加上预编译头 "stdafx"
或者在修改属性不是用预编译头
iamcaicainiao 2005-12-27
  • 打赏
  • 举报
回复
我估计楼主的原因就是楼上的。

vollin(林尚义)

説的原因
vollin 2005-12-27
  • 打赏
  • 举报
回复
是不是没
#inlcude "stdafx.h"
这个是VC用预编译选项必须要加的,要不然就会报那个错;
另外还就是 {}不匹配也这样,
0黄瓜0 2005-12-27
  • 打赏
  • 举报
回复
C:\fz117\fz117.cpp(493):fatal error c1004:
unexpected end of file found error executing c1.exe.
=============================
通常是{}不配对的原因。

就你上面的代码,加上类和变量声明,没什么问题。
lostlander 2005-12-27
  • 打赏
  • 举报
回复
unexpected end of file found
The compiler reached the end of a source file without resolving a construct. The code may be missing one of the following elements:
A closing brace
A closing parenthesis
A closing comment marker (*/)
A semicolon
Other possible causes
The default disk drive has insufficient space for temporary files, which require about twice as much space as the source file.
An #if directive that evaluates to false lacks a closing #endif directive.
A source file does not end with a carriage return and line feed.
The following sample generates C1004:
// C1004.cpp
#if TEST
// uncomment the next line
// #endif

int main() {
}
// C1004
myppfly 2005-12-27
  • 打赏
  • 举报
回复
那肯定是你自己少数了被
你能不能把所有的代码全贴出来啊

684

社区成员

发帖
与我相关
我的任务
社区描述
智能路由器通常具有独立的操作系统,包括OpenWRT、eCos、VxWorks等,可以由用户自行安装各种应用,实现网络和设备的智能化管理。
linuxpython 技术论坛(原bbs)
社区管理员
  • 智能路由器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧