zoukankan      html  css  js  c++  java
  • 第十天学习内容 函数

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace day10
    {
        class Class1
        {
            static void Main(string[] args)
            {
                while (true)
                {

                   Console.WriteLine("请输入你要打印的形状:");
                    Console.WriteLine("1、方形 2、菱形 3、平行四边形");
                    Console.Write("你的选择是:");
                    int x = Convert.ToInt32(Console.ReadLine());
                    xz(x);  //进入选择(xz)函数
                    //Console.ReadKey();
                }
            }
            static public void lx(int a)   //打印菱形
            {
               
                for (int i = 1; i <= a; i++)
                {
                    for (int j = 0; j < a-i; j++)
                    {
                        Console.Write("  ");
                    }
                    for (int k = 0; k < 2*i-1; k++)
                    {
                        Console.Write("●");
                    }
                    Console.Write(" ");
                }
                for (int i = 1; i <= a; i++)
                {
                    for (int j = 1; j <= i; j++)
                    {
                        Console.Write("  ");
                    }
                    for (int k = 0; k < 2*(a-i)-1; k++)
                    {
                        Console.Write("●");
                    }
                    Console.Write(" ");
                }
            }
            static public void fx(int a ,int b)   //打印方形
            {
                for (int i = 0; i < a; i++)
                {
                    for (int j = 0; j < b; j++)
                    {
                        Console.Write("★");
                    }
                    Console.Write(" ");
                }
            }
            static public void px(int a,int b)  //打印平行四边形
            {
                for (int i = 1; i <= a; i++)
                {
                    for (int j = 1; j <= i; j++)
                    {
                        Console.Write("  ");
                    }
                    for (int k = 0; k < b; k++)
                    {
                         Console.Write("◆");
                    }
                    Console.Write(" ");
                }
             
            }
            static public void xz(int a)
            {
                switch (a)
               
                {   case 1:
                         Console.Write("请输入你要打印的方形的高:");
                        int x = Convert.ToInt32(Console.ReadLine());
             
                        Console.Write("请输入你要打印的方形的宽:");
                        int y = Convert.ToInt32(Console.ReadLine());
                        fx(x,y);
                        break;
                    case 2:
                          Console.Write("请输入你要打印的菱形的行数:");
                        int z = Convert.ToInt32(Console.ReadLine());
                        lx(z);
                        break;
                    case 3:
                          Console.Write("请输入你要打印的平行四边形的高:");
                        int c = Convert.ToInt32(Console.ReadLine());
             
                        Console.Write("请输入你要打印的平行四边形的宽:");
                        int d = Convert.ToInt32(Console.ReadLine());
                        px(c,d);
                        break;
                    default:
                        break;
                }
            }  //选择函数

        }
    }

  • 相关阅读:
    cad.net DeepCloneObjects WasErased
    cad.net 更改高版本填充交互方式为低版本样子
    日志篇 VS Gitee码云
    测试篇 c#遍历所有安装程序 获取所有已经安装的程序
    cad.net 设置Acad2008默认启动 win10设置默认cad2008默认启动 20190923修改
    cad.net cad启动慢? cad2008启动慢? cad启动延迟? cad卡住? cad98%卡? 默认打印机!!
    测试篇 c#多线程实现ping 制作一个备份器
    cad.net 利用win32api实现不重复打开dwg路径的文件夹(资源管理器)
    cad.net 利用win32api实现一个命令开关参照面板 20190910修改浩辰部分问题,完美.
    cad.net 在cad2008引用了错误的com接口的dll导致出现了
  • 原文地址:https://www.cnblogs.com/William-1234/p/4334225.html
Copyright © 2011-2022 走看看