C#中的变量定义以及初始化测试案例1 (一看就懂)
https://www.runoob.com/csharp/csharp-variables.html
输出
变量声明以及初始化,代码案例1
using System;
#region 1helloword程序
//namespace ChuXueZheZhiNan1
//{
// class Program
// {
// static void Main(string[] args)
// {
// Console.WriteLine("Hello World!");
// Console.ReadLine();
// }
// }
//}
#endregion
namespace ChuXueZheZhiNan1
{
class Program
{
static void Main(string[] args)
{
short a;
int b;
double c;
//声明变量
short d;
int e;
double f;
/* 实际初始化 */
a = 10;
b = 20;
c = a + b;
d = 1;
e = 2;
f = d + e;
Console.WriteLine("a = {0}, b = {1}, c = {2}", a, b, c);
Console.WriteLine("d = {0}, e = {1}, f = {2}", d, e, f);
Console.ReadLine();
}
}
}