这个C++程序出啥问题了?为什么VC会在编译连接时报错。

来源:百度知道 编辑:UC知道 时间:2024/05/21 02:49:37
#include <iostream>
using namespace std;

main()
{
int n;
cin>>n;
for (int i = n; i !=100; i++)
{
cout<<"循环输出中,I="<<i<<endl;
}

cout<<"已经循环结束 ";

system("pause");
return 0;

}

+++++++++++++++++++++++++++++

--------------------Configuration: 1011 - Win32 Release--------------------
Compiling...
1011.cpp
Linking...
LINK : error : Internal error during ReadSymbolTable
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 00465817
NumberParameters = 00000002
ExceptionInformation[ 0] = 00000000
ExceptionInformation[ 1] = 00FE1204
CONTEXT:
Eax = 00FE1200 Esp = 0012F61C
Ebx = 00000000 Ebp = 004A2520
Ecx = 00FE1200 Esi = 00FC0F3C
Edx = 00000001 Edi =

main前面没加int,看输出像是bug

你如果n的初值赋为一个大于100的数,for (int i = n; i !=100; i++)
这个循环就会一直执行下去而不会停止,自然最后会越界。所以会提示你所说的错误。
把循环条件改一下吧!

我在我的vc6.0上运行了一便,很正常啊,没什么错的,你再运行试试,如果还是有错,可能是你得软件出问题了吧

用int main()试试