I need some help understanding what I am supposed to do for this homework. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I need some help understanding what I am supposed to do for this homework.

" In this paper you will present a C ++ application made by you. Using the binary display procedure affis_bin make a program that uses repetitive instructions to display various images You will use a vector with 8 int-type elements that you will initialize with int values between 0 and 255. Using the binary display affis_bin procedure, display the content of the vector and thus obtain various images depending on the values with which you initialized the vector. In trying to put such values to get the most interesting images. " *affis_bin shows the binary value of a number (with colorful squares instead of 1 and 0, 1 being light square, 0 being dark square) *Is a vector the same as a array? With [ ] ? *by repetitive instructions does it mean loops? *in c++ the random numbers will always be the same, so am I supposed to use a seed? I don't have any code to show, I don't need anyone to do my homework, I just need some guidance, that is all. (An example of how the output should look like would be great)

24th Mar 2020, 8:54 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
2 Answers
+ 2
A vector is similar to an array but is heap allocated and automatically resizes. This means the size of a vector can change during execution. The [] operator is overloaded for vectors in order to work exactly as on arrays. I guess yeah, loops should be the way to go. A seed would be nice but first I would use a constant seed and later switch to a random one. Sadly I don't fully understand how exactly a generated image should look like but I think the affis_bin function is given so you just need to use it I guess...
24th Mar 2020, 9:25 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 1
Values in the range [0, 255] would result in 8 8-bit values, so I guess the result should be a series of 8x8 pixel images, obtained through some kind of repetitve formula? Then the skeleton would be to initialize the array (or vector or whatever) with some values, and then to apply a transformation you come up by yourself and to display the image. Rinse, repeat. Although "the most interesting" image is surely very fuzzy criteria, but I think I wouldn't initialize the values randomly, since then you would have absolutely no idea what the outcome would like (but maybe I'm just misunderstanding something there). This is just a demo, but I would imagine something like the following: https://code.sololearn.com/c1kOEAAASAHN/?ref=app
24th Mar 2020, 10:01 PM
Shadow
Shadow - avatar