下学期要跟着另一伙人去做kinect了,用的是c#,这个假期学学~
//这个和python import导入包是类似的,using system基本上都是要用到的 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace css_l2 { class Program { static void Main(string[] args) { //基本的数据类型 //int 4个字节 long是8个字节 char是一个Unicode字符,可以存数0-65535之间的整数 //bool布尔类型的 string是一组字符 字符串 //变量的命名 不能是数字开头 大小写的形式慢慢的去适应吧 string comparison; Console.WriteLine("Enter a number:"); //类型转换:用户ReadLine进来的就字符串 使用的时候去convert //Convert.To...() double var1 = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Enter another number:"); double var2 = Convert.ToDouble(Console.ReadLine()); //if语句记住只能接受bool 比如int num = 0; if (num)之类的都不行的 要if(num != 0) if(var1 < var2) { comparison = "less than"; } else { if(var1 == var2) { comparison = "equal"; } else { comparison = "greater than"; } } //{0}, {1}之类的就是占位符,用后面的变量的值来代替 Console.WriteLine("The first number is {0} the second number.", comparison); Console.ReadKey(); } } }
原文:http://www.cnblogs.com/virusdefender/p/3559598.html