C#1113变量类型
·



namespace Variable
{
internal class Program
{//int a,b,c
int a;
int b;
int c;
int d;
int JJ阿斯顿;
int l = 1;
int 撒旦 = 2;
int s = 3;
void Set()
{
s = 100;
}
static void Main(string[] args)
{
string input = "";
Console.Write("input=:");
input = Console.ReadLine();
Console.WriteLine("Hello, World!");
Console.WriteLine("变量Input=" + input);
}
}
}

变量类型
namespace Variable
{//bool 布尔值 true /false 默认false
//byte 8位无符号整数 0-255 默认0
//char 字符 U+0000 U+ffff "\0"
//decimal 128位精确十进制 0.0M
//double 64位双精度浮点 小数一般都用
//float 32单精度 小数一般都用
//int 32位有符号整数 一般都用
//long 64位有符号整数类型
//sbyte 8位有符号整数 -128-127
//short 16位有符号整数
//
internal class Program
{//int a,b,c
int a;
int b;
int c;
int d;
int JJ阿斯顿;
int l = 1;
int 撒旦 = 2;
int s = 3;
void Set()
{
s = 100;
}
static void Main(string[] args)
{
string input = "";
Console.Write("input=:");
input = Console.ReadLine();
Console.WriteLine("Hello, World!");
Console.WriteLine("变量Input=" + input);
sbyte a2= -200;//-128-+127 超出范围
short num1 = 234000;//短整型 -32768-+32767
int count = 23456;
}
}
}


namespace Variable
{//bool 布尔值 true /false 默认false
//byte 8位无符号整数 0-255 默认0
//char 字符 U+0000 U+ffff "\0"
//decimal 128位精确十进制 0.0M
//double 64位双精度浮点 小数一般都用
//float 32单精度 小数一般都用
//int 32位有符号整数 一般都用
//long 64位有符号整数类型
//sbyte 8位有符号整数 -128-127
//short 16位有符号整数
//
internal class Program
{//int a,b,c
int a;
int b;
int c;
int d;
int JJ阿斯顿;
int l = 1;
int 撒旦 = 2;
int s = 3;
void Set()
{
s = 100;
}
static void Main(string[] args)
{
string input = "";
Console.Write("input=:");
input = Console.ReadLine();
Console.WriteLine("Hello, World!");
Console.WriteLine("变量Input=" + input);
//整型
// sbyte a2= -200;//-128-+127 超出范围
// short num1 = 234000;//短整型 -32768-+32767
// int count = 23456;
// int size = sizeof(int);//获取类型字节数
//浮点型
//float double decimal
// float f1 = 4.5;
float f2 = 4.5f;
double f3 = 4.5;
decimal d3 = 4.5M;
bool b1= true;
//bool值
int count = 3;
bool blAdd = (count > 0);//ture
//字符型 char
char c = '\r\n';
ushort intC = c;//65
// \n换行
Nullable<int> value=null;
int? value1 = null;//
//所有类型后都可加?表示可空类型描述 null
}
}
}

更多推荐


所有评论(0)