注册 登录
编程论坛 C++教室

求帮助,高手快来帮帮我

炎枫 发布于 2011-04-21 16:50, 377 次点击
D:\Program Files\Microsoft Visual Studio\MyProjects\ff\ff.cpp(19) : fatal error C1004: unexpected end of file found
这是什么错误
#include "stdafx.h"

int main(int argc, char* argv[])
{  int i,n,s,a[10];
    printf("enter a integer :");
    scanf("%d",&n);
    printf("enter %d integer :",n);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    for(s=n-1;s=-1;s--)
    {scanf("%d",&a[s]);
    printf("%d",a[1]);
    return 0;
    }
谢谢
4 回复
#2
ucyan2011-04-21 17:23
第二个for循环应该为 s == -1
最后少了一个花括号
你的主要错误在下面
#include "stdafx.h"
是预编译的头文件,但是如果是你自己建的文件一般都没有stdafx.h。如果建立工程的时候你选择console->简单的程序,就会有
+ Simple Win32 Console application.这时候就不会出错。



[ 本帖最后由 ucyan 于 2011-4-21 17:28 编辑 ]
#3
weide27084022011-04-21 19:37
for(s=n-1;s>=-1;s--)
#4
pangding2011-04-21 19:43
vc 有时候会冒些诡异的错误。

一般出现这种错误的时候,去百度一下错误号就行了。
比如百度一下“error C1004”,一般都有解决方法。
#5
炎枫2011-04-24 13:05
回复 4楼 pangding
哦哦,谢谢
1