#include "stdio.h"
void main()
{
int Row;
int Line;
int Temp;
int Nomber = 7;
for (Row = 0; Row < (Nomber + 1)/2; Row++)
{
printf_s("%d", Row + 1); //新添加的。
for (Line = 0; Line < ((Nomber + 1)/2 - 1) - Row; Line++)
{
printf_s(" ");
}
for (Temp = 0; Temp <= 2*Row; Temp++)
{
printf_s("*");
}
printf_s("\n");
}
for (Row = 0; Row < ((Nomber + 1)/2 - 1); Row++)
{
printf_s("%d", Row + 5); // 新添加的。
for (Line = 0; Line <= Row; Line++)
{
printf_s(" ");
}
for (Temp = 0; Temp <= ((Nomber + 1)/2 - 2*Row); Temp++)
{
printf_s("*");
}
printf_s("\n"); //你要是vc6.0 就修改为printf
}
}
我替你做了。。无语了。估计你在纠结。。我说话有点火,希望你用心学习。。。
基本思想都给你了,你敢不敢自己动点脑子??你这种态度态度真心没法学好C++。。这么简单的问题,你都解决不了?
你控制一下,每行的第一个输出数字,从第二个开始循环不会??稍微动个脑子啊,大神。。。
追问谢谢!!!!