#include #include #include using namespace std; int main() { srand(time(nullptr)); const int width = 640; const int height = 480; cout << "P3\n" << width << " " << height << "\n255\n"; for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { int gray = rand() % 256; cout << gray << " " << gray << " " << gray << " "; } cout << "\n"; } return 0; }