关于for循环
#include<iostream>using namespace std;
int main()
{
const int ARRAY_LENGTH= 5;
int myNums[ARRAY_LENGTH]= {0};
cout<<"Populate array of"<< ARRAY_LENGTH <<"integers"<<endl;
for(int counter=0;counter<ARRAY_LENGTH;+counter)
{
cout<<"Enter an integer for element"<<counter<<":";
cin>>myNums[counter];
}
cout<<"DisPlaying contents of the array:"<<endl;
for(int counter=0;counter<ARRAY_LENGTH;++counter)
cout<<"Element"<<counter<<"="<<myNums[counter]<<endl;
return 0;
}
问一下大神,为什么这段代码打完,编译不通过,错误信息栏双击开之后就是乱码啊。我是照着书上打的啊,检查几遍了,代码和书上一样的,就是查不出哪里错了,能帮我指出来吗?谢谢了