#include #include using namespace std; int main() { const int ncols {200}; const int nrows {200}; const int mid {ncols / 2}; const int miny {-mid}; const int maxy {mid}; const int minx {-mid}; const int maxx {mid}; cout << "P3\n"; cout << (ncols + 1) << " " << (nrows + 1) << "\n"; cout << "255" << "\n"; for (int y {maxy}; y >= miny; --y) { for (int x {minx} ; x <= maxx; ++x) { if (y >= x && y >= -x) { cout << "255 255 0\n"; } else if (y <= x && y > -x) { cout << "0 0 255\n"; } else if (y < x && y <= -x) { cout << "255 0 0\n"; } else { cout << "0 0 0\n"; } } } return EXIT_SUCCESS; }