1
I need to implement the code that manages a chess board in ppm. It would be in the standard 8x8 format, with the option of the user to set the pixel number, the doubt would be when to loop to "multiply" the pixels. In the code below is coming out in the standard 8x8:
#include <stdio.h>
int main()
{
int larg, alt;
larg = alt = 8;
printf("P2\n");
printf("%d\t%d\n", larg, alt);
printf("255\n");
int i, j;
int tamanho = 2;
for(i = 0; i < larg; i++){
for( j = 0; j < alt; j++){
if((i + j) %2 != 0){
printf("0\t");
}
else{
printf("255\t");
}
}
printf("\n");
}
return 0;
}
I hope that has been made clear, and I apologise in advance for any possible mistake, as this is my first question.
"a chessboard in ppm" - What does that mean ppm ? And what is the particular difficulty you are having in concrete ? What part is not being done/ failed to do ?
– Isac