RE: SLC21 Week2: Programmin arrays

You are viewing a single comment's thread from:

SLC21 Week2: Programmin arrays

in slc21w2sergeyk •  13 days ago 
Task Comment Grade
1) Declare an array of any type: explain how to use an array, how to access array elements.Assign values ​​to some of its elements, and use those values ​​display) What are the advantages of an array over ordinary variables You explained the array and how it is used well 1.5/1.5
2) What is **the name** of the array? What will happen if you display this value on the screen? What does `cout<&lta+2;`that mean (cout<&lta-2;)? If `cout<&lta;` displays 4,000, then how much will it be`a+1?` You are mistaken about "impossible" and that memory does not exist. Everything exists there, and everything is possible. It is physically possible, just as you can cross the street at a red light. Possible, but forbidden. Similarly, a[-2] is simply someone else's value; yes, it’s out of bounds of the array and not an element of the array, but it can be read. Given that our array is of data type integer, `cout<&lta+1; 4001` here the answer is incorrect, and the reason is exactly what you mention. 0.9/1.5
3) Can an array have two dimensions? 1/1
4) Write a random number in the variable k. `int k=(rand()%101) * (rand()%101) * (rand()%101)+500;` Try to solve the task of finding divisors from the last lesson more efficiently (so that the divisors are found faster) and write the results (not on the screen) but in an array. _Since the transfer of arrays to a function is not a simple topic - filling the array should not be done in the form of a function!!!_ `"Find divisors efficiently up to the square root of k,"` but why exactly up to the square root? Many find this unclear. Results should be nicely displayed, meaning the numbers are mixed, but they shouldn’t be sorted—they can be ordered by considering their placement. 1.1/2
5) Fill the array with 55 numbers with random numbers from 10 to 50. If there is a number 37 among the elements of the array, print it `yes`, and if there is no such number, print it `no` This is how many of my students write when learning programming)), but `yes/no` should be printed only once, as the answer at the end of the analysis. 0.4/1
6) Fill an array of 66 numbers with random numbers from 12 to 60. Replace even elements with 7 and odd elements with 77 Good, but the initial array should be displayed, as you show the result. 0.9+/1
7) Fill the array of 77 numbers with random numbers from 102 to 707. Find the two largest numbers. But the phrase "the two largest numbers" can have many interpretations. Therefore, first explain well how this phrase was understood. And then solve the problem. When showing the answer, the input numbers should also be displayed; otherwise, it’s unclear whether the result is correct. It seems there is a situation where the condition on line 27 will never be fulfilled, so `secondLargest` will == INT_MIN. Also, it would be ideal to find the two largest in one cycle, rather than first finding one, then the other. 1.5/2
Total: 7.3/10
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!