摘要: 练习:一、石头、剪刀、布,编辑程序//int a=r.Next(0,3); //int b=r.Next(0,3);//switch (a) //{ // case 0://剪刀 // x = "剪刀"; // break; // case 1://石头 // x = "石头"; // break;... 阅读全文
posted @ 2015-03-13 20:44 白天\不懂/夜的黑 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 练习:一、石头、剪刀、布,编辑程序//int a=r.Next(0,3); //int b=r.Next(0,3);//switch (a) //{ // case 0://剪刀 // x = "剪刀"; // break; // case 1://石头 // x = "石头"; // break;... 阅读全文
posted @ 2015-03-13 20:44 白天\不懂/夜的黑 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 练习题:一、 三个红球,五个白球,六个黑球,任取八个球且必须有一个白球,可能性有多少? int a = 0; for (int i = 0; i 0) { Console.WriteLine(i + "个白球;" + i1 + "个红球;" + i2 + "个黑球"); a++; } }... 阅读全文
posted @ 2015-03-12 17:37 白天\不懂/夜的黑 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 函数void是没有返回值,括号内是参数private只能在当前类里面用,public公用的,可以在整个命名空间使用函数 函数创建与使用 示例一 身份证截取 static public string jiequ(string a) { string p = a.Substring(6, 8); C... 阅读全文
posted @ 2015-03-10 21:30 白天\不懂/夜的黑 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 哈希表的应用输入人名与成绩,求总分、平均分及不及格人名和分数?Hashtable ht = new Hashtable(); Console.WriteLine("人数"); int n = Convert.ToInt32(Console.ReadLine()); double sum = 0;... 阅读全文
posted @ 2015-03-09 17:24 白天\不懂/夜的黑 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 练习题:彩票static void Main(string[] args) { Random r = new Random(); int[] caipiao = new int[7]; while (true) { ... 阅读全文
posted @ 2015-03-08 11:20 白天\不懂/夜的黑 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 打闹钟时间编程 DateTime dt = new DateTime(); dt = DateTime.Now; string t = "2015-3-6 10:00"; DateTime x = Convert.ToDateTime(t); while (true) { if (dt>... 阅读全文
posted @ 2015-03-06 21:21 白天\不懂/夜的黑 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 首先学习了类,分为string类和Math类!一、stringstring x = Console.ReadLine();int i=x.Length;//Length是截取字符长度,返回一个int值x=x.Trimm();//去掉字符前后的空格x=x.ToLower;//大写变小写x=x.ToUp... 阅读全文
posted @ 2015-03-05 14:08 白天\不懂/夜的黑 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 练习了for循环、while等等!一、打印菱形: Console.Write("请输入一个数"); int n = Convert.ToInt32(Console.ReadLine()); for (int i = 1; i 30&&n50) // { // m = m + 10; // ... 阅读全文
posted @ 2015-03-03 17:23 白天\不懂/夜的黑 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 练习题:(一) 1—100之间,输入两个数,算两个数之间的和?//Console.WriteLine("请输入一个整数"); //int a = Convert.ToInt32(Console.ReadLine()); //Console.WriteLine("请在输入一个整数"); //in... 阅读全文
posted @ 2015-03-03 12:51 白天\不懂/夜的黑 阅读(97) 评论(0) 推荐(0) 编辑