摘要: 程序设计课第七周课件里推荐的阅读材料,秉持着“翻译是理解外语学习资料的最佳方式”的理念,自己做了一个翻译。原文地址:http://www.cs.swarthmore.edu/~newhall/unixhelp/c_codestyle.html写在开头:对于一个刚进入软工专业不到两个月的新生而言,里面的一些指导是不必要的(比如还没学函数,那只能把“低级的细节”都放在main函数里)。里面一些建议跟我实际编程时的方案也不太一样,比如对于if-else结构,我通常是这样写的if{ stmt1;}else{ stmt2;}而不是if{ stmt1;} else { stmt2;... 阅读全文
posted @ 2012-11-04 15:50 Joyee 阅读(1488) 评论(0) 推荐(1) 编辑
摘要: 院开学典礼的PPT里布置的作业,虽然没有要求交,还是自己做了一下。Software Engineering Code of Ethics and Professional Practice (Version 5.2)软件工程道德及业务准则(第5.2版)原文来自:http://www.acm.org/about/se-codeSoftware engineers shall commit themselves to making the analysis, specification, design, development, testing and maintenance of softwar 阅读全文
posted @ 2012-11-04 13:09 Joyee 阅读(786) 评论(0) 推荐(0) 编辑
摘要: DescriptionMisspelling is an art form that students seem to excel at. Write a program that removes the n th character from an input string.InputThe first line of input contains a single integer N , (1≤N≤1000) which is the number of datasets that follow.Each dataset consists of a single line of input 阅读全文
posted @ 2012-11-01 23:19 Joyee 阅读(518) 评论(10) 推荐(0) 编辑
摘要: Description编程求解一个小班同学的测验平均分,得分为0到100之间的整数,由于可能有同学请假等原因,出席同学人数不定,输入以-1作为结束。求解平均数,保留1位小数输出。Input输入分数,直到输入-1结束。Output输出所有分数的平均值,保留1位小数就算对我这种菜鸟也是白痴题了……注意设成浮点型就OK。一次ACView Code 1 #include 2 int main() 3 { 4 float n, total=0.0; 5 int counter=0; 6 while( scanf("%f" , &n) && ( n + 1 &g 阅读全文
posted @ 2012-11-01 23:06 Joyee 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Description 小明有n本新书,要借给3位小朋友,假设每人每次只能借一本。小明想知道一共有多少种不同的借法,聪明的你需要写个程序来帮忙小明,输出一共有多少种借法,并输出这些借法,按照字典序排序。Input输入多个case每个case如下:输入n其中 10 > n >= 3Output对于每个case,第一行,输出借法的个数;接着每一行输出一种借法。一开始没看懂题目什么意思,琢磨半天明白了,就是把ABCD....J这十个字母按字典顺序进行排列。用了实验作业里写的函数,在处理字母的问题上用ASCII码与数字的对应处理,一次ACView Code 1 // Problem#: 6 阅读全文
posted @ 2012-11-01 23:04 Joyee 阅读(329) 评论(0) 推荐(0) 编辑
摘要: Description一只公鸡值五文钱;一只母鸡值三文钱;三只小鸡值一文钱。请问用n文钱买m只鸡的方案有多少种?Input输入有多个case,每个case如下n m其中n,m 2 int main() 3 { 4 int cock, hen, chick, n, m, cost, counter=0, num; 5 6 while( scanf("%d%d", &n, &m ) != EOF ) 7 { 8 for( cock = 0; cock 2 int main() 3 { 4 int cock, hen, chick, n,... 阅读全文
posted @ 2012-11-01 22:55 Joyee 阅读(668) 评论(0) 推荐(0) 编辑
摘要: Description1, 1, 2, 3, 5, 8, 13, 21...... 为菲波拉契数列(Fibonacci Sequence),该数列从第 3 项开始,每项都可表示成前2 项的和,即:F(i)=F(i-1)+F(i-2),i>=3。编程计算第 n 项的值。Input输入有多个case, 每个case是1行,只有一个整数n (1 2 int main() 3 { 4 long long unsigned n, i, a, a2 = 0, a1 = 1; 5 6 while( scanf("%llu", &n) != EOF ) 7 { 8 ... 阅读全文
posted @ 2012-11-01 22:36 Joyee 阅读(328) 评论(0) 推荐(0) 编辑
摘要: DescriptionIn the final exam, you are given n problems to solve, each one of which has an integer value indicating its difficulty, the larger, the harder. You need to find out which problem is the hardest.InputInput may contain several test cases, one per line. For each test case, the first integer 阅读全文
posted @ 2012-10-25 15:45 Joyee 阅读(403) 评论(0) 推荐(0) 编辑
摘要: DescriptionFind and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum of its digits when represented in hexadecimal (base 16) notation and also equals the sum of its digits when represented in duodecimal (base 12) notation.For examp 阅读全文
posted @ 2012-10-25 15:08 Joyee 阅读(857) 评论(0) 推荐(0) 编辑
摘要: 本周的实验课堂上作业,课前已经完成Description陶陶家的院子里有一棵苹果树,每到秋天树上就会结出10个苹果。苹果成熟的时候,陶陶就会跑去摘苹果。陶陶有个30厘米高的板凳,当她不能直接用手摘到苹果的时候,就会踩到板凳上再试试。现在已知10个苹果到地面的高度,以及陶陶把手伸直的时候能够达到的最大高度,请帮陶陶算一下她能够摘到的苹果的数目。假设她碰到苹果,苹果就会掉下来。Input输入包括两行数据。第一行包含10个100到200之间(包括100和200)的整数(以厘米为单位)分别表示10个苹果到地面的高度,两个相邻的整数之间用一个空格隔开。第二行只包括一个100到120之间(包含100和12 阅读全文
posted @ 2012-10-25 14:42 Joyee 阅读(684) 评论(0) 推荐(0) 编辑