0

0

使用forloop-** u,t,o,n,z,x,e,f,h,k,m,y,w,w,p,q,r **

霞舞

霞舞

发布时间:2025-02-15 14:40:29

|

548人浏览过

|

来源于dev.to

转载

u,t,t,o,n,z,x,e,f,h,k,m,y,w,p,p,q,r

package Afterfeb4;

public class forlooppattern1 {

    public static void main(String[] args) {
        // findstar();
        // findU();
        // findT();
        // finfO();
        // findN();
        // findZ();
        // findX();
        // findparttenE();
        // findparttenF();
        // findparttenH();
        // findparttenK();
        // findpartternM();
        // findpartternY();
        // findpartternW();
        // findpartterP();
        // findpartternQ();
        findpartternR();

    }

    private static void findpartternR() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (col == 1 || row == 1 && col <= 5 || col == 5 && row <= 5 || row == 5 && col <= 5 || row - col == 5)

                    System.out.print("* ");

                else
                    System.out.print("  ");

            }
            System.out.println();
        }

    }

    private static void findpartternQ() {
        for (int row = 1; row <= 9; row++) // ---
        {
            for (int col = 1; col <= 9; col++)// ||
            {
                if (col == 1 && row <= 7 || col == 7 && row <= 7 || row == 1 && col <= 7 || row == 7 && col <= 7
                        || col == row && row > 3)

                    System.out.print("* ");

                else
                    System.out.print("  ");

            }
            System.out.println();
        }

    }

    private static void findpartterP() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (col == 1 || row == 1 || col == 9 && (row <= 5) || row == 5)

                    System.out.print("* ");

                else
                    System.out.print("  ");

            }
            System.out.println();
        }

    }

    private static void findpartternW() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (col == 1 || col == 9 || col + row == 10 && (row >= 5) || col == row && (row >= 5))

                    System.out.print("* ");

                else
                    System.out.print("  ");

            }
            System.out.println();
        }

    }

    private static void findpartternY() {

        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (col + row == 10 && (row <= 5) || col == row && (row <= 5) || col == 5 && (row >= 5))

                    System.out.print("* ");

                else
                    System.out.print("  ");

            }
            System.out.println();
        }

    }

    private static void findpartternM() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (col == 1 || col == 9 || col + row == 10 && (row <= 5) || col == row && (row <= 5))

                    System.out.print("* ");

                else
                    System.out.print("  ");

            }
            System.out.println();
        }

    }

    private static void findparttenK() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (row + col == 4 || row - col == 2 || col == 1)
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    private static void findparttenH() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (row == 5 || col == 9 || col == 1)
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    private static void findparttenF() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (row == 1 || row == 5 || col == 1)
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    private static void findparttenE() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (row == 1 || row == 5 || row == 9 || col == 1)
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    private static void findX() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (col + row == 10 || col == row)
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    private static void findZ() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (row + col == 10 || row == 1 || row == 9)
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    private static void findN() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (row == col || col == 1 || col == 9)
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    private static void finfO() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (row == 1 || row == 9 || col == 1 || col == 9)
                    System.out.print("* ");

                else
                    System.out.print("  ");

            }
            System.out.println();
        }

    }

    private static void findT() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                if (row == 1 || col == 5)
                    System.out.print("* ");
                else {
                    System.out.print("  ");

                }
            }
            System.out.println();
        }
    }

    private static void findU() {

        for (int row = 1; row <= 9; row++)// ---
        {
            for (int col = 1; col <= 9; col++) {
                if (col == 1 || col == 9 || row == 9)// || col
                    System.out.print("* ");
                else
                    System.out.print("  ");
            }
            System.out.println();
        }

    }

    private static void findstar() {
        for (int row = 1; row <= 9; row++) {
            for (int col = 1; col <= 9; col++) {
                System.out.print("* ");
            }
            System.out.println("  ");
        }

    }

}


相关专题

更多
C++ 高级模板编程与元编程
C++ 高级模板编程与元编程

本专题深入讲解 C++ 中的高级模板编程与元编程技术,涵盖模板特化、SFINAE、模板递归、类型萃取、编译时常量与计算、C++17 的折叠表达式与变长模板参数等。通过多个实际示例,帮助开发者掌握 如何利用 C++ 模板机制编写高效、可扩展的通用代码,并提升代码的灵活性与性能。

10

2026.01.23

php远程文件教程合集
php远程文件教程合集

本专题整合了php远程文件相关教程,阅读专题下面的文章了解更多详细内容。

29

2026.01.22

PHP后端开发相关内容汇总
PHP后端开发相关内容汇总

本专题整合了PHP后端开发相关内容,阅读专题下面的文章了解更多详细内容。

21

2026.01.22

php会话教程合集
php会话教程合集

本专题整合了php会话教程相关合集,阅读专题下面的文章了解更多详细内容。

21

2026.01.22

宝塔PHP8.4相关教程汇总
宝塔PHP8.4相关教程汇总

本专题整合了宝塔PHP8.4相关教程,阅读专题下面的文章了解更多详细内容。

13

2026.01.22

PHP特殊符号教程合集
PHP特殊符号教程合集

本专题整合了PHP特殊符号相关处理方法,阅读专题下面的文章了解更多详细内容。

11

2026.01.22

PHP探针相关教程合集
PHP探针相关教程合集

本专题整合了PHP探针相关教程,阅读专题下面的文章了解更多详细内容。

8

2026.01.22

菜鸟裹裹入口以及教程汇总
菜鸟裹裹入口以及教程汇总

本专题整合了菜鸟裹裹入口地址及教程分享,阅读专题下面的文章了解更多详细内容。

55

2026.01.22

Golang 性能分析与pprof调优实战
Golang 性能分析与pprof调优实战

本专题系统讲解 Golang 应用的性能分析与调优方法,重点覆盖 pprof 的使用方式,包括 CPU、内存、阻塞与 goroutine 分析,火焰图解读,常见性能瓶颈定位思路,以及在真实项目中进行针对性优化的实践技巧。通过案例讲解,帮助开发者掌握 用数据驱动的方式持续提升 Go 程序性能与稳定性。

9

2026.01.22

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
10分钟--Midjourney创作自己的漫画
10分钟--Midjourney创作自己的漫画

共1课时 | 0.1万人学习

Midjourney 关键词系列整合
Midjourney 关键词系列整合

共13课时 | 0.9万人学习

AI绘画教程
AI绘画教程

共2课时 | 0.2万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号