level 2
贝克街的小伟
楼主
本人编写的一个显示 (下图)的编码,用VC6.0可以实现,但在codeblocks上显示不能使用,要用整形返回,为什么?如果用整形返回,应该返回什么?,谢谢。。。。
#include<iostream>
using namespace std;
void main()
{int i;
int a,b,j;
cout<<"请输入您想要的长度:"<<endl;
cin>>j;
if(j>=50)
{
cout<<"您输入的过大,请重新输入:"<<endl;
cin>>j;
}
for(i=1;i<=j;i++)
{
for(b=0;b<50-2*i;b++)
{cout<<" ";}
for(a=0;a<4*i-3;a++)
{
cout<<"*";
}
cout<<endl;
}
}
*
***
*****
*******
2014年10月21日 11点10分
1
#include<iostream>
using namespace std;
void main()
{int i;
int a,b,j;
cout<<"请输入您想要的长度:"<<endl;
cin>>j;
if(j>=50)
{
cout<<"您输入的过大,请重新输入:"<<endl;
cin>>j;
}
for(i=1;i<=j;i++)
{
for(b=0;b<50-2*i;b++)
{cout<<" ";}
for(a=0;a<4*i-3;a++)
{
cout<<"*";
}
cout<<endl;
}
}
*
***
*****
*******