#include #include using namespace std; //Flag of Italy. int main() { const int nrows {100}; //number of rows of pixels const int ncols {120}; //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 255 0\n"; //left third is green } else if (col < ncols * 2/3) { cout << "255 255 255\n"; //middle third is white } else { cout << "255 0 0\n"; //right third is red } } } return EXIT_SUCCESS; }