打印下列图形 * * * * * * * * ** * * * * * * * * * * * * * * *求简单算法!~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 LZ ,此图形可分上下两个,用for循环即可。还是自己动手比较好..鉴定OVer 先上边再下边啊上边四行,大概大概是这样for(i=1;i<=4;i++){for(int a=0;a<2*i-1;a=a++){System.out.print("*");}System.out.println("");} fuck了,居然写出 a=a++;把a= 去掉 用嵌套for循环打印用一个外循环打印换行-就是自动换行用两个并列内循环打印一个打印星号一个打印空格 public class Sample { public static void main(String[] args) { System.out.println("*"); System.out.println(" ***"); System.out.println(" *****"); System.out.println("*******"); System.out.println(" *****"); System.out.println(" ***"); System.out.println(" *"); } }还有更简单的吗 亮亮代码 * *** ************ ***** *** *#include <iostream>#include <cmath>int main() { const int row = 5; // 5行,对于行对称的,使用绝对值来做比较好 const int max = row / 2 + 1; for (int i = -max + 1; i < max; ++i) { for (int j = 0; j < abs(i); ++j, std::cout << " "); for (int j = 0; j < (max - abs(i)) * 2 - 1; ++j, std::cout << "*"); std::cout << std::endl; } return 0;} 我想实现单击 查询书库 子节点后 弹出一个新窗体 我查了很多方法 因为不是很熟悉 总是实现不了 麻烦帮我看看怎么改 谢谢 帮忙,万分感谢 为什么过不去呢? 菜鸟提问:如何用数组构成链表实现数三退一 一个急盼解决的问题 关于读写Properties文件的问题!急! 问一个日期方面的问题? 帮忙看看这个程序有错没? 那位大哥给我发份连接sql2000的jdbc驱动,高分! 可否将网页文件的源代码作为String一次性读入吗? 如何消除死代码上的警告? 为什么会出现nullpointexception 错误?
上边四行,大概大概是这样
for(i=1;i<=4;i++){
for(int a=0;a<2*i-1;a=a++)
{System.out.print("*");}
System.out.println("");
}
用一个外循环打印换行-就是自动换行
用两个并列内循环打印
一个打印星号
一个打印空格
public static void main(String[] args) {
System.out.println("*");
System.out.println(" ***");
System.out.println(" *****");
System.out.println("*******");
System.out.println(" *****");
System.out.println(" ***");
System.out.println(" *");
}
}还有更简单的吗 亮亮代码
***
*****
*******
*****
***
*#include <iostream>
#include <cmath>int main() {
const int row = 5; // 5行,对于行对称的,使用绝对值来做比较好
const int max = row / 2 + 1; for (int i = -max + 1; i < max; ++i) {
for (int j = 0; j < abs(i); ++j, std::cout << " ");
for (int j = 0; j < (max - abs(i)) * 2 - 1; ++j, std::cout << "*");
std::cout << std::endl;
} return 0;
}