#include #include using namespace std; int main() { const int nrows {200}; //number of rows of pixels const int ncols {300}; //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 (row < nrows/3) { cout << "0, 0, 0\n"; //upper half is blue } else if (row < nrows * (2/3)) { cout << "225, 0, 0\n"; //lower half is yellow } else { cout << "255, 204, 0\n"; } } } return EXIT_SUCCESS; }