码迷,mamicode.com
首页 >  
搜索关键字:c语言 例题 c语言例题    ( 2623个结果
例题:判断平年还是闰年。理解使用异常语句try catch finally 和datetime 时间类
while (true) { Console.Write("请输入一个年份:"); int rn =Convert .ToInt32 ( Console.ReadLine()); //输入一个年份 //string s = ""; try //尝试,保护起来,使程序出错也能执行 { DateTim....
分类:其他好文   时间:2015-04-17 23:42:52    阅读次数:130
Python学习
在业余时间学习一下跨平台代码python。下面是http://courses.ischool.berkeley.edu/i155/su13/schedule.htm下的例题代码。留作未来参考语法。1 #hw1_1.py2 x=input("Input the number of gallons of...
分类:编程语言   时间:2015-04-17 22:14:17    阅读次数:202
例题:请输入一个时间,判断是一天中的哪个时间。逻辑思维比较强的一个题。主要复习一下if else语句
while (true) { Console.Write("请输入一个时间(24小时制):"); //string s = Console.ReadLine(); int hour = Convert.ToInt32(Console .ReadLine ()); if(hour >= 0 && h....
分类:其他好文   时间:2015-04-16 23:27:42    阅读次数:187
例题:输入学生的各项资料,然后根据学生的分数,重新排序。重新复习结构体,集合,数组,for循环,冒泡排序,水平符的使用。
class Program { struct student //定义一个student的结构体 { public string name; //基本格式 public int code; public int age; public int fenshu; } static void Main(....
分类:编程语言   时间:2015-04-16 23:22:09    阅读次数:129
例题:一对幼兔,一个月后长成小兔,小兔一个月后长成成兔并生下一对幼兔,问n个月后有多少对兔子。这个题主要是学习计算机思维,我们只需要把条件告诉计算机,让计算机算结果
static void Main(string[] args) { // 本月的成兔=上月的小兔+上月的成兔 // 本月的小兔=上月的小兔 // 本月的幼兔=本月的成兔 Console.WriteLine("请输入月数:"); int m = Convert.ToInt32(Console.R...
分类:其他好文   时间:2015-04-16 23:14:39    阅读次数:154
例题:用集合做总分平均分。比较好理解的一种做法。
static void Main(string[] args) { ArrayList al = new ArrayList(); Console.Write("请输入人数"); int n = Convert.ToInt32(Console.ReadLine()); for (int i = 0....
分类:其他好文   时间:2015-04-16 11:51:03    阅读次数:123
例题:while 的用法,占位符,
static void Main(string[] args) { int n = 1; while (n < 6) //在括号内直接限制循环条件 { Console.WriteLine( "打印结果{0},{1}",n,2*n); n = n + 1; //需要在中括号内给出改变方式,否则将进入....
分类:其他好文   时间:2015-04-16 11:43:44    阅读次数:132
例题:用集合算总分平均分。
static void Main(string[] args) { ArrayList al = new ArrayList();//集合里面所有类型都可以放入 Console.Write("请输入人数:"); int n = Convert.ToInt32(Console.ReadLine());...
分类:其他好文   时间:2015-04-15 19:08:41    阅读次数:116
例题:机选双色球,用到集合,集合里的sort排序,for循环,.Next随机数。知识点很多
while (true) { Random r = new Random();//定义随机数 ArrayList red = new ArrayList();//集合类型可以放入 while (true) { if (red.Count == 6)//红球包含六个数 { break;//选出六个.....
分类:编程语言   时间:2015-04-15 19:04:40    阅读次数:124
例题:函数输出参数。理解函数的作用,函数是一个相对独立的代码块
class Program { public int[] shuchucanshu(int[] shu,out int a,out int b) //基本格式,定义一个int数组 { for (int i = 0; i < shu.Length ; i++) //冒泡排序 { for (int j ...
分类:其他好文   时间:2015-04-15 16:59:02    阅读次数:134
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!