#include #include using namespace std; int main() { const int nrows {50}; //number of rows of pixels const int ncols {60}; //number of columns of pixels cout << "P3\n" << ncols << " " << nrows << "\n" << 255 << "\n"; for (int row {0}; row < nrows; ++row) { for (int col {0}; col < ncols; ++col) { if (col < ncols / 3) { cout << "0 128 0\n"; //left third is green } else if (col < ncols * 2 / 3 ) { cout << "255 255 255\n"; //middle third is white } else { cout << "255 140 0\n"; //right third is orange } } } return EXIT_SUCCESS; }