-
namespace Test
{
class Program
{
static void Main(string[] args)
{
int x = 1;
bool a = ++x * x > 3;
bool b = a ;
Console.WriteLine(a==b);
}
}
}
查看全部 -
标识符只能由英文字母、数字和下划线组成,不能包含空格和其他字符。查看全部
-
赋值从右向左
查看全部 -
Writelone 写完换行
write 写完不换行查看全部 -
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
string [] t = new string []{"C","Sh","a","rp"};
foreach(string x in t)//遍历字符串数组t
{
Console.Write(x);
}
}
}
}
查看全部 -
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
//声明整型数组,保存一组整数
int[] num = new int[] { 3,34,42,2,11,19,30,55,20};
for(int x = 0;x < num.Length;x++)//循环打印数组中的偶数
{
if(num[x]%2 == 0)
{
Console.Write(num[x]+",");
}
}
}
}
}
查看全部 -
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
int [] score = new int[]{89,39,100,51,94,65,70};
Console.Write("不及格的有:");
for(int x = 0; x < score.Length;x++)
{
if(scroe[x] < 60)
Console.Write(scroe[x]+",");
}
}
}
}
查看全部 -
- Console,WriteLine=(ture>false);
- Console,WriteLine=(ture<false);
- int=ture;
查看全部 -
double x = (5-3);
int y = 3;
stick,write= (x<y);查看全部 -
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
for(int x = 1; x <= 12; x++)
{
Console.WriteLine(x + " ");
}
}
}
}
查看全部 -
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
int x = 1;//定义变量,初始化变量
while(x <= 5)//循环条件
{
Console.WriteLine("加油!");
x++; //自加
}
}
}
}
查看全部 -
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
int x = 5;
while(x >= 1)
{
Console.WriteLine(x+“ ”);
x--;
}
}
}
查看全部
举报