摘要: string email = Console.ReadLine(); if (email.Contains("@") && email.Contains(".com")) { Console.WriteLine("这是一个正确的邮箱地址"); int intex = email.IndexOf("... 阅读全文
posted @ 2015-04-14 23:37 zhenximeiyitian 阅读(279) 评论(0) 推荐(0) 编辑
摘要: static void Main(string[] args) { string sj = "abcdefghijklmnopqrstuvwxyz"; while (true) { Random r = new Random(); //定义随机数,固定格式 string s1 = sj.Substr... 阅读全文
posted @ 2015-04-14 23:07 zhenximeiyitian 阅读(284) 评论(0) 推荐(0) 编辑
摘要: DateTime a = DateTime.Now;//获取电脑现在的时间 DateTime nz = Convert.ToDateTime("2015-4-14 22:44");//定义闹钟的时间 while (true) { a = a.AddMinutes(1); //显示时间,一分钟加一... 阅读全文
posted @ 2015-04-14 22:48 zhenximeiyitian 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Console.WriteLine("请为五位同学开始投票(0/1/2/3/4):"); int[] vote = new int[5];//给五个人投票,定义一个长度为5的数组,每一个下标代表一个人 for (int i = 0; i 4) { Console.WriteLine("废票请重新... 阅读全文
posted @ 2015-04-14 22:27 zhenximeiyitian 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Console.Write("请输入评委人数:");//输入人数 int renshu = Convert.ToInt32(Console.ReadLine());//人数代入 int[] fenshu = new int[renshu];//定义一个分数的数组,长度为人数 if (renshu >... 阅读全文
posted @ 2015-04-14 22:19 zhenximeiyitian 阅读(337) 评论(0) 推荐(0) 编辑
摘要: Console.WriteLine("请输入您的身份证号码"); string x = Console.ReadLine(); string year=x.Substring (6,4);//从身份证的第六位开始截取,往后截取四位,就是你的出生年份 int x1 = Convert.ToInt32(... 阅读全文
posted @ 2015-04-14 22:11 zhenximeiyitian 阅读(437) 评论(0) 推荐(0) 编辑
摘要: while (true) { Console.WriteLine("请输入行李重量"); double k = Convert.ToDouble(Console .ReadLine ()); if (k >= 0 && k = 50) { double m; m = k * 0.25 +... 阅读全文
posted @ 2015-04-14 21:48 zhenximeiyitian 阅读(678) 评论(0) 推荐(0) 编辑
摘要: while (true) { string s = "★";//s代表五角星 string t = "○";//t代表方格,如果需要只打印正三角形,可用空格键代替 int a = 1;//声明变量,初始值为1 Console.Write("请输入行数"); a = Convert.ToInt32(C... 阅读全文
posted @ 2015-04-14 21:39 zhenximeiyitian 阅读(339) 评论(0) 推荐(0) 编辑
摘要: namespace 打印乘法口诀{ class Program { static void Main(string[] args) { for (int i = 1; i <=9; i++)//行数循环九次, { for (int j = 1; j<=i; j++)//当i等于1的时候,j等于1, ... 阅读全文
posted @ 2015-04-14 21:29 zhenximeiyitian 阅读(217) 评论(0) 推荐(0) 编辑
摘要: while (true) { Console.WriteLine("请输入您的生日(年-月-日)");//提示输入 string x = Console.ReadLine();//代入 DateTime dt = Convert.ToDateTime(x);//强制转换成时间类型,跟int,str... 阅读全文
posted @ 2015-04-14 21:10 zhenximeiyitian 阅读(645) 评论(0) 推荐(0) 编辑
摘要: 知识要点:集合和数组的区别:数组是连续的,同一类型的一块区域,而集合可以是不连续的,多种数据类型的。集合属性:.count方法:.Add() 将对象添加到ArrayList中实际包含的元素数.Clear() 从移除所有元素.Clonr() 创建的浅表副本.Contains() 确定某元素是否在中.I... 阅读全文
posted @ 2015-04-14 15:57 zhenximeiyitian 阅读(853) 评论(0) 推荐(0) 编辑
摘要: decimal a = 1;//定义初始值,decimal可以定义比较长的数值 decimal sum = 1; Console.WriteLine("第1个格子里有1粒米");//输出第一句话 for (int i = 2; i <= 20; i++)//假设棋盘有20个格子,因为上边已经输出第... 阅读全文
posted @ 2015-04-14 14:32 zhenximeiyitian 阅读(924) 评论(0) 推荐(1) 编辑