C#基礎入門篇(2)

using System;

namespace scendDay_17_8_3

{

class MainClass

{

public static void Main (string[] args)

{

Console.WriteLine ("Hello World!");

//讀取一個字符,隨意按下一個字符后終止輸入操作

// int n = Console.Read ();

// Console.WriteLine ("剛剛輸入N的值為{0}", n);

//讀取字符串,按回車結束輸入操作2;

// string sir = Console.ReadLine();

// Console.WriteLine ("剛剛輸入sir的值為"+sir);

// Console.Write("你好\n");//\n換行符

// Console.WriteLine("剛剛");

//類型轉化

// 隱試轉化,強制轉化

// float a=1f;

// double b = 1.2f;

//強制轉化

// a=(float)b;

// int c = (int)1.7f;

//字符串轉換成int值 字符串應為純數字 若有字母則會失敗

// string num="123";

// int d = int.Parse (num);

//獲取內存占用 bytes(字節)? > bits(位,比特)? 1:8的比例

// Console.WriteLine("int->{0}",sizeof(Int16));

//運算符

// + - * / % += -=? >? <? >=? <= ++ -- ?: &&(與) ||(或) !(非)

// & | ^? << >>

// int a=1, b=2, c=3;

// int b=2;

// int c=3;

// float d=1.0f;

//強轉

// int e = a + (int)d;

//c=c-a == c-=a

//比較

//int a=34, b=45;

int a=1;

//a++;//a=a+1;

//a--;//a=a-1;

}

}

}

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容