#include #include using namespace std; //this output is a flag consisting of five vertical stripes of the same size. int main() { const int nrows {100}; //number of rows of pixels const int ncols {125}; //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/5) { cout <<"0 0 0\n"; //left end is black } else if (col < ncols*2/5) { cout << "255 255 255\n"; //left middle is white } else if (col < ncols*3/5) { cout << "0 0 0\n"; //middle center is black } else if (col < ncols*4/5) { cout << "255 255 255\n"; //right middle is white } else { cout << "0 0 0\n"; //right end is black } } } return EXIT_SUCCESS; }