标签:3.1 inf 布尔 world line threading mes 名称 支持
1.
using System; using System.Collections.Generic; using System.Ling; using System.Text; using System.Threading.Tasks;//命名空间,支持类库调用 namespace helloworld //项目名称 { class Program //这就是一个类 { static void Main(string[] args)//方法 (主方法)/主函数 { //程序运行启动地方 Console.WriteLine("Hello World");//输出显示 Console.ReadKey();//暂停程序 } } }
2.
using System; using System.Collections.Generic; using System.Ling; using System.Text; using System.Threading.Tasks;//命名空间,支持类库调用 namespace helloworld //项目名称 { class Program //这就是一个类 { static void Main(string[] args)//方法 (主方法)/主函数 { int num; num = 10;//定义一个整数变量 double d;//小数型,double包含了int float f = 3.14f;//uniity使用float d = 3.14; string str; str = "huang";//需加双引号 char c;//单字符型 c = ‘a‘;/ar赋值用单引号 bool b;//布尔类型,判断对错 b = true; b = false; Console.WriteLine(num); } } }
练习
1.
using System; namespace _001lianxi { class Program { static void Main(string[] args) { string name = "卡卡西"; string place = "火影村"; int age = 30; string postBox = "kakaxi@qq.com"; double wage = 2000; //Console.WriteLine("我叫"+ name+ ",我住在"+ place+ ",我今年" + age+ ",我的邮箱是" + postBox + ",我的工资是" + wage); Console.WriteLine("我叫{0},今年{1}岁,家庭住址是{2},我的邮箱是{3},我的工资是{4}", name, age, place, postBox, wage); } } }
2.
交换变量值:
using System; namespace _005 { class Program { static void Main(string[] args) { int a = 10; int b = 5; a = b - a; b = b - a; a = a + b; Console.WriteLine(a); Console.WriteLine(b); } } }
3.
using System; namespace _007 { class Program { static void Main(string[] args) { Console.WriteLine("请输入姓名"); string name = Console.ReadLine();//用于接收用户的输入 Console.WriteLine("请输入年龄"); string age = Console.ReadLine(); Console.WriteLine("请输入性别"); string Gender = Console.ReadLine(); Console.WriteLine("您好:{0}先生,您的年龄是{1},还是一个帅气逼人的{2}生", name, age, Gender); } } }
4.
标签:3.1 inf 布尔 world line threading mes 名称 支持
原文地址:https://www.cnblogs.com/huang--wei/p/9373706.html