如何用C语言实现“无限猴子画画机”?

“无限猴子画画机”:用户依次输入两个正整数,程序以这两个正整数为分辨率生成一张图片,各个像素的颜色随机,可能是分辨率相同的任意一张图片。


#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <time.h>

// 主函数
int main()
{
    srand((unsigned)time(NULL));
    int w, h;
    scanf("%d%d", &w, &h);

    initgraph(w, h);

    for(int i = 0; i < w; i++)
    {
        for(int j = 0; j < h ; j++)
        {
            putpixel(i, j, RGB((rand() % 255), (rand() % 255), (rand() % 255)));
        }
    }
    _getch();
    closegraph();
    return 0;
}

可以用openc实现