// outRaw_grad.cpp - creating a gradient
#include <iostream>
#include <fstream>

int main() {
  using namespace std;
  char filename[20];
  unsigned char val = 0; 
  
  cout << "Enter a filename (e.g. pic.raw):";
  cin >> filename;
  
  // a condensed way of creating a ofstream object and 
  // assigning a file at the same time. 
  ofstream fout(filename);
  
  // getting the 
  for(int i=0;i<400;i++) {
    val = char((i/400.0)*255);
    fout << val;
  }
  
  fout.close();

}
