#include <iostream>
int main ()
{
int s[2][8]=
{
{1,2,3,4,5,6,7,8},
{8,7,6,5,4,3,2,1}
};
for (int a=0;a<=2;a++)
for (int b=0;b<=8;b++)
std::cout<<s[a][b]<<std::endl;
system("pause");
return 0;
}
#include <iostream>
int main ()
{
int s[2][8]=
{
{1,2,3,4,5,6,7,8},
{8,7,6,5,4,3,2,1}
};
for (int a=0;a<=2;a++)
for (int b=0;b<=8;b++)
std::cout<<s[a][b]<<std::endl;
system("pause");
return 0;
}
for (int a=0;a<=2;a++)
for (int b=0;b<=8;b++)
这两个循环中的<=都改成<,<=会越界的~