-
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
????????????int x = 1;
????????????bool a = ++x * x > 3;
????????????bool b = a ;
????????????Console.WriteLine(a==b);
? ? ? ?}
? ? }
}
查看全部 -
標(biāo)識(shí)符只能由英文字母、數(shù)字和下劃線組成,不能包含空格和其他字符。查看全部
-
賦值從右向左
查看全部 -
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)//遍歷字符串?dāng)?shù)組t
? ? ? ? ? ??
? ? ? ? ? ? {
? ? ? ? ? ? ? ? Console.Write(x);
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
查看全部 -
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? //聲明整型數(shù)組,保存一組整數(shù)
? ? ? ? ? ? int[] num = new int[] { 3,34,42,2,11,19,30,55,20};
? ? ? ? ? ? for(int x = 0;x < num.Length;x++)//循環(huán)打印數(shù)組中的偶數(shù)
?????????????{
????????????? 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)//循環(huán)條件
????????????{
?????????????????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--;
????????}
????}
}
查看全部
舉報(bào)