求该题错误的地方并改正

来源:百度知道 编辑:UC知道 时间:2024/07/04 20:15:53
#include<cstdlib>
#include<iostream>
using namespace std
int main(int arge,char*argv[])
{ int depth,i,j,k;
cout<<"please input the count of depth:";
cin>>depth;
for (k=0;k<depth;k++)
{ for(i=depth-1;i>0;i++)
{ cout<<" "
}
for (i=i;j<2*(depth-i);i++)
{ cout<<"*";
{
cout<<endl
}
}

#include<cstdlib>
#include<iostream>
using namespace std; //少分号
int main(int arge,char*argv[])
{ int depth,i,j,k;
cout<<"please input the count of depth:";
cin>>depth;
for (k=0;k<depth;k++)
{ for(i=depth-1;i>0;i--) //i--
{ cout<<" ";//少分号
}
for (j=i;j<2*(depth-i);j++) //对j进行循环
{ cout<<"*";
}//原来的{ 不配对
cout<<endl ;//少分号
}
return 0; //最好有返回值
}

#include<cstdlib>
#include<iostream>
using namespace std;
int main(int argc,char*argv[])
{
int depth,i,j,k;
cout<<"please input the count of depth:";
cin>>depth;
for (k=0;k<depth;k++)
{
for(i=depth-1;i>0;i--)
{
cout<<" " ;
}
for (j=i;j<2*(depth-i);j++)
{
cout<<"*";
}