#include #include using namespace std; //Flag of United States. //Run it like this: ./a.out | /usr/bin/pnmtopng > usa.png // file usa.png // cp usa.png public_html int main() { int stripeHeight {10}; //height of each stripe in pixels int nrows {13 * stripeHeight}; //height of entire flag in pixels int ncols {nrows * 19 / 10}; //width of entire flag in 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 < 7 * stripeHeight && col < ncols * 2 / 5) { cout << "10 49 97\n"; //blue union jack } else if (row % (2 * stripeHeight) < stripeHeight) { cout << "99 25 66\n"; //red stripe } else { cout << "255 255 255\n"; //white stripe } } } return EXIT_SUCCESS; }