摘要: while (true) { Console.Write("请输入你的楼梯数:"); int n = Convert.ToInt32(Console.ReadLine()); int fenshu = 0; if (n > 100) { Console.WriteLine("您输入的楼梯数有误!")... 阅读全文
posted @ 2015-04-18 12:36 zhenximeiyitian 阅读(181) 评论(0) 推荐(0) 编辑
摘要: c# ToString() 格式化字符串 格式化数值:有时,我们可能需要将数值以一定的格式来呈现,就需要对数值进行格式化。我们使用格式字符串指定格式 格式说明符 说明 示例 输出 C 货币 2.5.ToString("C") ¥2.50 D 十进制数 25.ToString("D5") 00025 ... 阅读全文
posted @ 2015-04-18 10:33 zhenximeiyitian 阅读(178) 评论(0) 推荐(0) 编辑
摘要: while (true) { Console.Write("请输入一个年份:"); int rn =Convert .ToInt32 ( Console.ReadLine()); //输入一个年份 //string s = ""; try //尝试,保护起来,使程序出错也能执行 { DateTim... 阅读全文
posted @ 2015-04-17 22:39 zhenximeiyitian 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 在新建查询里输入代码创建数据库以及数据库中的表create database xuesheng --创建数据库,xuesheng为数据库的库名drop database xuesheng --删除数据库,命令没有执行use xuesheng --使用数据库,命令已经执行gocreate table ... 阅读全文
posted @ 2015-04-17 13:10 zhenximeiyitian 阅读(215) 评论(0) 推荐(0) 编辑
摘要: class Program { struct student //定义一个student的结构体 { public string name; //基本格式 public int code; public int age; public int fenshu; } static void Main(... 阅读全文
posted @ 2015-04-16 22:11 zhenximeiyitian 阅读(283) 评论(0) 推荐(0) 编辑
摘要: while (true) { Console.Write("请输入一个时间(24小时制):"); //string s = Console.ReadLine(); int hour = Convert.ToInt32(Console .ReadLine ()); if(hour >= 0 && h... 阅读全文
posted @ 2015-04-16 21:54 zhenximeiyitian 阅读(232) 评论(0) 推荐(0) 编辑
摘要: static void Main(string[] args) { // 本月的成兔=上月的小兔+上月的成兔 // 本月的小兔=上月的小兔 // 本月的幼兔=本月的成兔 Console.WriteLine("请输入月数:"); int m = Convert.ToInt32(Console.R... 阅读全文
posted @ 2015-04-16 21:35 zhenximeiyitian 阅读(1389) 评论(0) 推荐(0) 编辑
摘要: while (true) { Random r=new Random();//定义随机数 int a=r.Next(1,10); //定义一个千位数 int b = r.Next(1,10); //定义一个百位数 int c = r.Next(1,b);//再定义一个百位数 Console.Wr... 阅读全文
posted @ 2015-04-16 20:34 zhenximeiyitian 阅读(218) 评论(0) 推荐(0) 编辑
摘要: c#是微软公司在2000年7月发布的一种全新且简单、安全、面向对象的程序设计语言,是专门为.NET的应用而开发的语言。.NET框架为c#提供了一个强大的、易用的、逻辑结构一致的程序设计环境。函数的四要素:名称,输入,输出,加工namespace ConsoleApplication1 命名空间cla... 阅读全文
posted @ 2015-04-16 13:50 zhenximeiyitian 阅读(258) 评论(0) 推荐(0) 编辑
摘要: int[,] map = new int[10, 10] //定义一个二维数组,十行十列 { {1,1,1,1,1,1,1,1,1,1}, {1,0,0,0,0,0,1,0,0,1}, {1,0,2,0,0,0,1,0,0,1}, {1,0,0,0,0,0,1,0,0,1}, {1,0,0,0,0... 阅读全文
posted @ 2015-04-16 12:53 zhenximeiyitian 阅读(612) 评论(0) 推荐(0) 编辑