幸福勾勾手吧 关注:11贴子:35
  • 0回复贴,共1

C#入门基础(1)

只看楼主收藏回复

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using相当于Java中import
namespace Hello
//namespace:命名空间
class Program
//class:类
{
static void Main(string[] args)
//Main:主方法名,第一个字母大写,
{
Console.WriteLine("请输入:");
//接收键盘输入
Console.ReadLine();
//打印
Console.WriteLine("傻瓜,真是个傻丫头");
Console.ReadLine();
//数据类型
//int ,float ,string ,bool
//c#中的bool(布尔类型)于Java中的Boolean有区别
//c#中的数据类型都是小写
//c#中float类型赋值时后面必须加f
//运算符
//算术运算符
//+ - * / % ++ --
//比较运算符
//< > <= >= == !=
//条件运算符
//?:
//int b=1;
//int a=o;
//a=b==1?10:2;
//赋值运算符
//+= -= *= /= %=
//逻辑运算符
//&&(与) ||(或) !(非)
//注释
//行注释://
//块注释:/* dfdfafdfd */
//Console.WriteLine(); 是换行,加Line就换行,不加就不换行。
//Console.ReadLine(); 获取到的是字符串类型
//string转换成int : 转换类型=int.parse(目标类型)
}
}
}


IP属地:湖北1楼2012-12-22 10:36回复