正三角就把第二個(gè)循環(huán)的判斷條件改為x<=y;
倒三角就把第二個(gè)循環(huán)的初始賦值改為x=y
倒三角就把第二個(gè)循環(huán)的初始賦值改為x=y
2022-03-13
原來(lái)倒三角也能過(guò)哈哈哈
for (int y = 1; y <= 7; y++)
{
for (int x = y; x <= 7; x++)
{
Console.Write(x);
}
Console.WriteLine();//換行
for (int y = 1; y <= 7; y++)
{
for (int x = y; x <= 7; x++)
{
Console.Write(x);
}
Console.WriteLine();//換行
2022-03-13
for (int i = 1; i <= 7; i++)
{
for (int j = 1; j <= 7; j++)
{
Console.Write(i == j || i + j == 8 ? 'O' : '.');
}
Console.WriteLine();
}
Console.ReadKey();
{
for (int j = 1; j <= 7; j++)
{
Console.Write(i == j || i + j == 8 ? 'O' : '.');
}
Console.WriteLine();
}
Console.ReadKey();
2022-02-10
for (int x = 1; x <= y; x++)
2022-01-23
A和B不一樣的地方主要是!運(yùn)算符無(wú)法直接運(yùn)用于整數(shù)運(yùn)算符,再加上邏輯邏輯運(yùn)算符的優(yōu)先級(jí),也就?。ㄟ壿嫹牵﹥?yōu)先級(jí)是高于>(大于運(yùn)算符)的,實(shí)在不明白直接去VS跑一跑就知道了
2021-12-27
我這樣寫(xiě)的
for (int x=0;x<=6;x++)
{
for(int y=0;y<=6;y++)
{
if (y==x||y==6-x)
Console.Write('o');
else
Console.Write('.');
}
Console.WriteLine();
for (int x=0;x<=6;x++)
{
for(int y=0;y<=6;y++)
{
if (y==x||y==6-x)
Console.Write('o');
else
Console.Write('.');
}
Console.WriteLine();
2021-12-22