Menu

[Solved]1 Order Following Code Processing Image Pixels Picture Pic Queen Marypng Int X 0 X Picwidt Q37224826

1.In what order is the following code processing the imagepixels?

Picture pic(“queen-mary.png”);for (int x = 0; x < pic.width(); x++) { for (int y = 0; y < pic.height(); y++) { int red = pic.red(x, y); int green = pic.green(x, y); int blue = pic.blue(x, y); pic.set(x, y, 255 – red, 255 – green, 255 – blue); } }

Diagonally

Across each row, then down the left side of the next row

Down each column, then over the top of the next column

Impossible to tell from this snippet of code

2.What is printed by the following code snippet?

for (int i = 0; i < 5; i++){ for (int j = 0; j <= i; j++) { cout << i << ” “; }}

0 1 2 3 4 5

0 0 1 0 1 2 0 1 2 3 0 1 2 3 4

0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4

The code will not run due to a syntax error.

Expert Answer


Answer to 1.In what order is the following code processing the image pixels? Picture pic(“queen-mary.png”); for (int x = 0; x < pi... . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *