参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int high = scanner.nextInt(); int width = scanner.nextInt(); char c = scanner.next().charAt(0); int cc = scanner.nextInt(); for(int i = 0; i < width; i++) System.out.printf("%c", c); System.out.println(); for(int i = 0; i < high - 2; i++) { for(int j = 0; j < width; j++) { if(j == 0 || j == width - 1) System.out.printf("%c", c); else { if(cc == 0) System.out.print(" "); else System.out.printf("%c", c); } } System.out.println(); } for(int i = 0; i < width; i++) System.out.printf("%c", c); } }
0.0分
5 人评分
矩阵加法 (C语言代码)浏览:1720 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:593 |
永远的丰碑 (C语言代码)浏览:516 |
C语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:498 |
小O的图案 (C语言代码)浏览:912 |
孤独的骑士 (C语言代码)浏览:1363 |
1073题解浏览:622 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:1317 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:567 |
简单的a+b (C语言代码)浏览:244 |