I don’t understand why this code passes the checking system, but
don’t actually work no the image I give it to the algorithm, the image come out same.
void reflect(int height, int width, RGBTRIPLE image[height][width])
{
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
RGBTRIPLE temp;
if( j != width - j)
{
temp = image[i][j];
image[i][j] = image[i][width - j - 1];
image[i][width - j - 1] = temp;
}
if( j == width - j - 1)
{
j = width;
}
}
}
return;
}
this is the report:
🙂 reflect correctly filters 1×2 image
🙂 reflect correctly filters 1×3 image
🙂 reflect correctly filters image that is its own mirror image
🙂 reflect correctly filters 3×3 image
🙁 reflect correctly filters 4×4 image
expected “100 110 120n7…”, not “10 20 30n70 8…”(except this one)
Output Image: enter image description here
Mandar Gurav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.