Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  1
Language: C/C++
Code:

          #include <fstream>

using namespace std;

const int wide = 255, height = 255;

int main () {
     ofstream img ("picture.ppm");
     img << "P3" << endl;
     img << wide << " " << height << endl;
     img << "255" << endl;
     
     for (int y = 0; y < height; y++){
          for (int x = 0; x < width; x++){
               
               int r = x % 255;
               int g = y % 255;
               int b = y * x % 255;
               
               img << r << " " << g << " " << b << endl;
          }
     }
     
     system("open picture.ppm");
     
}
Comments: