2014年10月17----类别
////求一百以内的质数 ////q穷举把所有的可能都列出来,迭代循环里的循环 //int s = 0; //for (int i = 1; i <= 100;i++ ) //{ // if ( i %2 != 0 && i % 3 != 0 && i % 5 != 0 && i % 7!=0 && i!=1||i==2||i==3||i==5||i==7) // { // Console.Write(i); // Console.Write("\t"); // s = s + i; // } //} //Console.Write("总和为:{0}", s); //Console.ReadKey(); //Console.Write("点击回车开始抽奖"); //Console.ReadLine(); //Random r=new Random(); //for(int i=1;i<=100;i++) //{ //int shu=r.Next(131000,132000); // Console.Write(shu); // Thread.Sleep(20);//让程序暂停一段时间 // Console.Clear();//清空控制台之前打印的程序 //} //Console.WriteLine("121212"); //Console.ReadKey(); //穷举的题,穷举所有的可能性都列出来 //举行羽毛球比赛,拍子15元,球3元,矿泉水2,200元每样至少买一个,求所有正好花光的可能 //int qiu,pai,shui; //int a = 0; ////Console.WriteLine("输入您总共有多少钱"); ////int qian = int.Parse(Console.ReadLine()); ////Console.WriteLine("输入球的价格:"); ////int qiu = int.Parse(Console.ReadLine()); ////Console.WriteLine("输入拍子的价格:"); ////int pai = int.Parse(Console.ReadLine()); ////Console.WriteLine("输入瓶装水的价格:"); ////int shui = int.Parse(Console.ReadLine()); //for(qiu=1;qiu*3<200;qiu++) //{ // for(pai=1;pai*15<200;pai++) // { // for(shui=1;shui*2<200;shui++) // { // if (qiu * 3 + pai * 15 + shui * 2 == 200) // { // a++; // Console.WriteLine("第{0}种可能,买{1}个球,{2}副拍子,{3}瓶水",a,qiu,pai,shui); // } // } // } //} //Console.ReadKey(); ////输入钱数,拍子,球,水价格数,求所有的可能 //int d, b, c; //int a = 0; //Console.WriteLine("输入您总共有多少钱"); //int qian = int.Parse(Console.ReadLine()); //Console.WriteLine("输入球的价格:"); //int qiu = int.Parse(Console.ReadLine()); //Console.WriteLine("输入拍子的价格:"); //int pai = int.Parse(Console.ReadLine()); //Console.WriteLine("输入瓶装水的价格:"); //int shui = int.Parse(Console.ReadLine()); //for (d = 1; qiu * d < qian; d++) //{ // for (b = 1; b * pai < qian; b++) // { // for (c = 1; c * shui< qian; c++) // { // if (qiu *d+ pai *b + shui * c ==qian) // { // a++; // Console.WriteLine("第{0}种可能,买{1}个球,{2}副拍子,{3}瓶水", a, d, b, c); // } // } // } //} //Console.ReadKey(); ////公鸡三文钱,母鸡两文,小鸡半文,每种至少买一只,100文要买100只鸡,求所有的可能。 //int a = 1; //for (int g = 1; g * 2 < 100; g++) //{ // for (int m = 1; m * 1 < 100; m++) // { // for (int x = 1; x * 0.5 < 100; x++) // { // if (g * 2 + m * 1 + x * 0.5 == 100 && g + m + x == 100) // { // Console.WriteLine("第{0}种可能,公鸡有{1},母鸡有{2},小鸡有{3}", a, g, m, x); // a++; // } // } // } //} //Console.ReadKey(); //int a=0,s=0; //while(s<10) //{ // s++; // if (s <= 2) // { // a=s+a; // continue;//下面的都不执行了,直接跳回while(s<10) // } // if (s > 2 && s<= 10) // { // if (s == 10) // { // a += 100; // } // continue;//直接跳回while(s<10) // } // a += 10; //} //Console.WriteLine(a); //Console.ReadKey(); ////String a = 1; //string s = Console.ReadLine();//是大s的实例化,是对象 //int i = s.Length;//获取字符串的长度,返回一个int类型的值。显示长度的,输入abc,然后读出是3。输入的空格数字汉子都有一个算一个 //Console.Write(i); //Console.ReadLine(); //string s = Console.ReadLine(); //int i = s.Length; ////s=s.Trim();//能去除掉字符串前后的空格,字符中间的空格没法去掉。 ////s = s.TrimStart();//去掉输入的字符串前面的空格 //s = s.TrimEnd();//去掉输入字符串后面的空格 //Console.Write(s); //Console.ReadLine(); //string s = Console.ReadLine(); //int i = s.Length; ////s = s.ToUpper();//将字符串中的英文小写字母转换成大写 //s = s.ToLower();//将字符串中的英文大写字母转换成小写 //Console.Write(s); //Console.ReadLine(); //string s = Console.ReadLine(); //int i = s.Length; //s = s.Substring(2,5);//m,n 从左边第(0)m+1位开始截取字符,截取n个,如123456,如果是2,3的话就是345,字符串的编码是从零开始的 //Console.Write(s); //Console.ReadLine(); string s = Console.ReadLine(); //s = s.Substring(6,8);先截取18位身份证的从第六位起,截取8位 //string a = s.Substring(0, 4);//从上面起的8位中,选取前四位 //string c = s.Substring(4, 2);//从上面起的8位中,选取第4位到第6位 //string d = s.Substring(6, 2);//从上面起的8位中,选取第6位到第8位 string a = s.Substring(6, 4); string c = s.Substring(10, 2); string d = s.Substring(12, 2); Console.Write(a + "年" + c + "月" + d + "日"); Console.ReadLine(); //string s = Console.ReadLine(); //s = s.Replace("2", "5"); //Console.Write(s); //Console.ReadLine();