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 ("Please enter the shape you want to print:");
Console.WriteLine ("1, Square 2, Diamond 3, parallelogram");
Console.Write ("Your choice is:");
int x = Convert.ToInt32 (Console.ReadLine ());
XZ (x); Enter selection (XZ) function
Console.readkey ();
}
}
static public void lx (int a)//print Diamond
{
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 ("\ n");
}
for (int i = 1; i <= A; i++)
{
for (int j = 1; J <= I; j + +)
{
Console.Write ("");
}
for (int k = 0; k < a-i)-1; k++)
{
Console.Write ("");
}
Console.Write ("\ n");
}
}
static public void fx (int a, int b)//print Square
{
for (int i = 0; i < A; i++)
{
for (int j = 0; J < b; j + +)
{
Console.Write ("★");
}
Console.Write ("\ n");
}
}
static public void px (int a,int b)//print Parallelogram
{
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 ("\ n");
}
}
static public void xz (int a)
{
Switch (a)
{Case 1:
Console.Write ("Please enter the height of the square you want to print:");
int x = Convert.ToInt32 (Console.ReadLine ());
Console.Write ("Please enter the square width you want to print:");
int y = Convert.ToInt32 (Console.ReadLine ());
FX (x, y);
Break
Case 2:
Console.Write ("Please enter the number of lines of diamonds you want to print:");
int z = Convert.ToInt32 (Console.ReadLine ());
LX (z);
Break
Case 3:
Console.Write ("Please enter the height of the parallelogram you want to print:");
int c = Convert.ToInt32 (Console.ReadLine ());
Console.Write ("Please enter the width of the parallelogram you want to print:");
int d = Convert.ToInt32 (Console.ReadLine ());
PX (c,d);
Break
Default
Break
}
}//Select function
}
}
Day Learning content function