- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace test1
- {
- struct phonebook{
- public string name;
- public string phone;
- public string address;
- }
- enum season {spring , summer,autumn,winter};
- class Program
- {
- static void Main(string[] args)
- {
- //////////////////////////////////////////////////////////////////////////////////////
- Console.WriteLine("整數類型");
- Console.WriteLine("the sbyte : " + sbyte.MaxValue + " and " + sbyte.MinValue);
- Console.WriteLine("the short :" + short.MaxValue + " and " + short.MinValue);
- Console.WriteLine("the int :" + int.MaxValue + "and "+ int.MinValue );
- Console.WriteLine("the byte :" + byte.MaxValue +"and "+ byte.MinValue);
- Console.WriteLine("the ushort:" + ushort.MaxValue +"and "+ ushort.MinValue);
- Console.WriteLine("the uint :"+ uint.MaxValue+" and " + uint.MinValue);
- Console.WriteLine("the ulong :"+ulong.MaxValue+ " and "+ulong.MinValue);
- //////////////////////////////////////////////////////////////////////////////////////
- Console.WriteLine("浮點類型");
- Console.WriteLine("the float :"+ float.MaxValue +" and "+ float.MinValue);
- Console.WriteLine("the double" +double.MaxValue+ " and "+ double.MinValue);
- ////////////////////////////////////////////////////////////////////////////////////
- Console.WriteLine("十進制類型");
- Console.WriteLine("the decimal :" + decimal.MaxValue + " and " + decimal.MinValue);
- ////////////////////////////////////////////////////////////////////////////////////
- Console.WriteLine("布爾類型");
- Console.WriteLine("the bool :" + bool.FalseString+" and " + bool.TrueString);
- ////////////////////////////////////////////////////////////////////////////////////
- Console.WriteLine("字符類型");
- Console.WriteLine("位數爲16/t,取值範圍:在0和65535之間以雙字節編碼的任意字符");
- ////////////////////////////////////////////////////////////////////////////////////
- Console.WriteLine("枚舉類型");
- int s = (int)season.spring;
- int s1 = (int)season.summer;
- int s2 = (int)season.autumn;
- int s3 = (int)season.winter;
- Console.WriteLine("enum season {spring , summer,autumn,winter};");
- Console.WriteLine("season.spring is :" + s);
- Console.WriteLine("season.summer is :" + s1);
- Console.WriteLine("season.autumn is :" + s2);
- Console.WriteLine("season.winter is :" + s3);
- //////////////////////////////////////////////////////////////////////////////////////
- Console.WriteLine("結構類型");
- phonebook pb;
- pb.name = "mike";
- pb.phone = "135769478**";
- pb.address = "NanChang";
- Console.WriteLine(pb.name +"/t"+ pb.phone+"/t"+pb.address);
- /////////////////////////////////////////////////////////////////////////////////////
- }
- }
- }
C# :數據類型
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.