新手求助啊,基本的星星排列~~
c#吧
全部回复
仅看楼主
level 2
mu5003893 楼主
static void Main(string[] args)
{
Console.WriteLine("input number");
int x = Convert.ToInt32(Console.ReadLine());
int i,y;
string ss;
ss = "* ";
for (i = x-1; i >= 0; i--)
{
Console.Write(new string(' ',i));
for (y = 1; y <= x; y++)
{
Console.Write(ss, y);
}
Console.WriteLine();
}
}
为何负责控制"* "数量的y不起作用呢,明明 i 就起作用了啊,是哪里写错了。我才学了3天,求指导~!
2016年02月04日 04点02分 1
level 2
mu5003893 楼主
求助啊[泪]
2016年02月04日 04点02分 2
364021275 群号
2016年02月04日 09点02分
level 12
你要排列成什么样子?
还有,你的y明显起作用了。。。。
2016年02月04日 05点02分 3
应该是一开始少一个for。这个运行后是比如输入6,就是6个* 号拍成平行四边形,因为 i的递减确实发生了
2016年02月04日 07点02分
1