#include #include using namespace std; /* Flag of Dominican Republic. Download, compile, and run it like this: cd wget https://markmeretzky.com/fordham/1600/src/if/ukraine.C compile ukraine ukraine | /usr/bin/pnmtopng > public_html/ukraine.png Then point your web browser at https://storm.cis.fordham.edu/~jsmith/ukraine.png */ int main() { const int nrows {100}; //number of rows of pixels const int ncols {150}; //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 < 60){ if (row < 40){ cout << "0 0 255\n"; //top left is blue } else if (row > 60) { cout << "255 0 0\n"; //bottom left is red } else { cout << "255 255 255\n"; //middle is white } } else if (col > 90) { if (row < 40){ cout << "255 0 0\n"; //top right is red } else if (row > 60) { cout << "0 0 255\n"; //bottom right is blue } else { cout << "255 255 255\n"; //middle is white } } else { cout << "255 255 255\n"; } } } return EXIT_SUCCESS; }