![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c语言作业
uuntitledisinc
这个作者很懒,什么都没留下…
展开
-
[Pointers and C-String]D. Liang 7.18 Anagrams
好久没更新了,因为懒otzDescriptionWrite a function that checks whether two words are anagrams. Two words are anagrams if they contain the same letters in any order. For example, “silent” and “listen” are anagrams. The header of the function is as follows:int isAn原创 2020-05-23 16:01:13 · 348 阅读 · 0 评论 -
进制转换[Pointers and C-String]D. Liang 7.15 Decimal to hex D. Liang 7.16 Decimal to binary
DescriptionWrite a function that parse a decimal number into a hex number as a string. The function header are as follows:char * convertDecimalToHex(int value)HintDon’t submit the main() function.```cchar * convertDecimalToHex(int value){ int num=v原创 2020-05-23 15:57:58 · 485 阅读 · 0 评论 -
[Arrays]D. Liang 6.29 sicily 1145 校门外的树
我不想种树了,再见。Description某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米。我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置;数轴上的每个整数点,即0,1,2,……,L,都种有一棵树。由于马路上有一些区域要用来建地铁。这些区域用它们在数轴上的起始点和终止点表示。已知任一区域的起始点和终止点的坐标都是整数,区域之间可能有重合的部分。现在...原创 2020-05-03 18:26:43 · 274 阅读 · 2 评论 -
[Arrays]D. Liang 6.28 纸牌游戏
写6.28和6.29越写越发觉自己智商不够的事实。卑微。写这玩意写了好久……作业记录:Description桌子上有一叠牌,从第一张牌(即位于顶面的牌)开始从上往下依次编号为1~n。当至少剩下两张牌时进行以下操作:把第一张牌扔掉,然后把新的第一张牌放到整叠牌的最后。输入n,输出每次扔掉的牌,以及最后剩下的牌。Input第一行为一个整数t(0<t<20),表示测试用例个数。以下...原创 2020-05-03 18:22:29 · 417 阅读 · 0 评论 -
[Arrays]D. Liang 6.20 Computing the weekly hours for each employee
催更是第一生产力哈哈哈。作业记录DescriptionSuppose the weekly hours for all employee are stored in a two-dimensional array.Each row records an employee’s seven-day work hous with seven columns.For example, the f...原创 2020-05-03 17:04:52 · 320 阅读 · 0 评论 -
[Arrays]D. Liang 6.19 Sorting students on grades
DescriptionRewrite Listing 6.12, GradeExam.cpp, to display the students in increasing order of the number of correct answers.Suppose the answers for all students are stored in a two-dimensional arra...原创 2020-05-01 19:56:54 · 371 阅读 · 0 评论 -
[Arrays]D. Liang 6.6 Revising Listing 4.11
DescriptionListing 4.11 determines whether a number n is prime by checking whether 2, 3, 4, 5, 6, …, n/2 is a divisor. If a divisor is found, n is not prime. A more efficient approach to determine wh...原创 2020-04-30 00:09:00 · 205 阅读 · 0 评论 -
[Functions]D. Liang 5.24 Displaying date and time
DescriptionWrite a program to reads an integer n, which means the total seconds since midnight Jan 1,1970(eg., 1103203148 seconds). Display the date and time at that second.InputAn integer n (long)...原创 2020-04-29 23:57:20 · 166 阅读 · 0 评论 -
[Functions]D. Liang 5.23 Approximating the square root
DescriptionImplementing the sqrt function. The square root of a number n, can be approximated by repeated performing a calculation using the following formula:nextGuess = (lastGuess + n / lastGuess)...原创 2020-04-29 23:50:07 · 224 阅读 · 0 评论 -
[Functions]D. Liang 5.19 Using the sqrt function
DescriptionInput two integers A and B (0<A,B<1000, A<B), then prints the square root of all integers between A and B (including A and B).Example Input0 5Example Output Number SquareRoot...原创 2020-04-29 23:46:06 · 149 阅读 · 0 评论 -
[Loops]D. Liang 4.19 Printing numbers in a pyramid pattern
DescriptionWrite a program that reads an interger n, then display the n levels pyramid pattern. For example, if n=4, the pattern is as follow: 1 1 2 1 1 2 4 ...原创 2020-04-29 23:33:56 · 203 阅读 · 0 评论 -
**[Loops]D. Liang 4.16 Finding the factors of an integer**
C语言作业记录。DescriptionWrite a program that reads an integer n and displays all its smallest factors. For example, if the input ingeger is 120, the output should be as follows: 2 2 2 3 5InputAn intege...原创 2020-04-29 23:18:32 · 270 阅读 · 4 评论 -
[Loops]D. Liang 4.18 Printing four patterns using loop
DescriptionWrite a program that reads two intergers p(1<=p<=4) and n(3<=n<=10), then display one of the following patterns.For example, when n = 6, the outputs are as follow:Pattern 1...原创 2020-04-29 23:25:17 · 201 阅读 · 0 评论