谁帮我看看代码

来源:百度知道 编辑:UC知道 时间:2024/06/04 18:59:39
#include<iostream>
using namespace std;
void main()
{
char ch[4][4]={{'*','*',' ',' ',},{'*','*',' ',' ',},
{' ',' ',' ',' ',},{' ',' ',' ',' ',},};
int a=10; int z;
for(int o=0;o<a;o++)
{

for(o=0;o<a;o++)
{
for(z=0;z<10000;z++)
{

}
if(z==10000)
{
system("cls");
cout<<endl;
z=0;
continue;
}

}
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
cout<<ch[i][j];
}
cout<<"\n";
}
}
}

这段代码想让他输出1个图形每隔1秒就往下掉一行的样子,可是为什么。他老是以运行就下去了 或者。只掉了1行就没往下掉了呢? 请教各位大侠看看

#include<iostream>
using namespace std;
void main()
{
char ch[4][4]={{'*','*',' ',' ',},{'*','*',' ',' ',},
{' ',' ',' ',' ',},{' ',' ',' ',' ',},};
int a=10; int z;
for(int o=0;o<a;o++)
{

for(o=0;o<a;o++) // 你这里是不是该换个变量?比如说 int y=0?
// 不然程序只跑一次啊

{
for(z=0;z<10000;z++)
{

}
if(z==10000)
{
system("cls"); //而且cls是清屏,这样光标就到了第一行。如果你想“每秒”
//掉下来一行,那么最好根据现在是第几圈,输几个endl;
//在这里加个
// for(int t=0;t<o;t++)cout<<endl;
z=0;
continue;
}

}
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
cout<<ch[i][j];
}
cout<<"\n";
}
//如果你想让掉下来的