BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C语言代写 | Project Assignment 4

C语言代写 | Project Assignment 4

这个作业是用C语言完成二维数组、递归等的练习
Project Assignment 4  
Program 1. (20 points) Restructuring Your proj3_1.c
Project Assignment 4  
ask_user will interact with user bydisplaying messages and read data entered byuser. It accepts a 3-element int arraycalled spec  
as its input parameter. It stores data entered byuser including the size of the array, the min and max of desired random numbers in  
spec[0], spec[1], and spec[2], respectively, so the caller, i.e., main, can use these data to complete its job.  
make_array will base on its input parameter s to set up a two-dimensional square arrayd of size s with all elements of random  
numbers between low and high. Then, it displays the arrayon screen as shown in the screenshot given for proj3_1.c. When the  
caller, i.e., main, calls this function, it will have the arrayprinted and readyfor further process.  
row_sum will use its input arrayd whose size is specified byanother parameter s and calculate the sum of each row of d. Like  
proj3_1.c, all row sums are printed in one line of the form “Row totals: n1 n2 n3 n4 ……”  
column_sum will do similar job as row_sum does. It uses its input arrayd whose size is specified byanother parameter s and  
calculate the sum of each column of d. All column sums are printed in one line of the form “Column totals: n1 n2 n3 n4 ……”  
5. Modifythe main function so it no longer performs the details of all tasks as in proj3_1.c, instead, it does all bydeclaring necessary  
variables, initializing random number generator, and calling the above functions.  
6. From user’s perspective, he/she still interacts with the program exactlythe same as proj3_1.c does. There should be no difference in  
the output display.  
Program 2. (20 points) Making Recursive Function Calls  
Based on the file proj4_1.c completed above, save an extra copyof this file as proj4_2.c as a new version of the same program and  
modifyit to satisfythe new requirements listed below.  
1
. proj4_2.c runs the same main function as that in proj4_1.c with no code change.  
. This program also keeps all four functions defined in proj4_1.c but with two modified below.  
. row_sum is modified so it becomes a recursive function. There are several ways to turn it into recursion but, for this assignment  
2
3
purpose, you onlymodifyit in three parts described below so each time it is called, it calculates and prints the sum of onlyone row.  
It adds a 3rd input int parameter called which_row. It tells which row’s sum the function needs to calculate. For example, the main  
will first call this function with a value of 0 for this parameter.  
No nesting (or double-layered) loops is used. If nesting or double loops is how you implement this function in proj4_1.c, you will  
eliminate one in this version. (Hint: The onlyloop used here is the one to accumulate the sum from each column element of the row.  
Since outer loop is not allowed, that’s whyit calls itself to calculate the sum of next row with which_row incremented byone.)  
Because the row header “Row totals: ” should be printed onlyonce before printing the sum of the top row, this recursive function  
needs to detect if it is calculating the sum of the top row. If no, it would skip printing the row header.  
bestdaixie