RE: SLC21 Week2: Programmin arrays

You are viewing a single comment's thread from:

SLC21 Week2: Programmin arrays

in slc21w2sergeyk •  16 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 Okay, but there's a typo there `array[0] = 5,` either it's not 5 here, or it's not 10 further on 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?` In general, `a` is a constant, and it cannot be moved - it would be more accurate to say that `a+2` generates an address value 8 bytes larger than the address of `a`. 1.4/1.5
3) Can an array have two dimensions? The translation is to blame here - I meant `size` and not `dimension` 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!!!_ This task was carried over from the previous lesson, so the main thing here was to search for the root of the number, but why the root? And not n, n/2, n/3?? It was also worth ordering the obtained divisors, not sorting them using general methods, but ordering them. 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` It's good that both `yes` and `no` answers were demonstrated, but how did you achieve this? Did you run it several times until the numbers with/without the number 37 came out? 1/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 Okay, but you should also output the input array to visually verify the correctness of the program. 0.8/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. It's good that you explained what "two largest" is, because I've come across several variations of this problem. Initializing "candidates for the largest" with zeros is reckless, especially with identical values. In addition, there may be a situation when there is no answer, for example, when all are the same. What will the program answer when all elements are zeros, or when all are -111? 1,5/2
Total: 8.2/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!