帮忙看下这个VC++编译问题

来源:百度知道 编辑:UC知道 时间:2024/06/02 20:52:44
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
The thread 0xFC8 has exited with code 4 (0x4).
The program 'C:\Documents and Settings\lenovo\桌面\Debug\sds.exe' has exited with code 4 (0x4).
程序我运行了 输入一个数然后DOS自动关闭了!! 什么情况
源程序代码如下
# include <stdio.h>
void main()
{int s,n,t;
s=0;
n=1;
scanf("%d",&t);
while (n<=t)
{s=s+n;
n=n+1;
}
printf("s=%d",s);
}

加个 pause
# include <stdio.h>
void main()
{int s,n,t;
s=0;
n=1;
scanf("%d",&t);
while (n<=t)
{s=s+n;
n=n+1;
}
printf("s=%d",s);
pause;
}
这样应该就行了
好长时间没弄过了,不知道加的对不对

在楼上所说的位置加
system("PAUSE");
或者
return 0;
这是告诉编译器当程序运行到这地方的时候要暂停住