Bitmap/Write a PPM file: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (Automated syntax highlighting fixup (second round - minor fixes)) |
(→{{header|C++}}: removed useless stuff and used C++ style casts) |
||
Line 487: | Line 487: | ||
{{trans|C}} |
{{trans|C}} |
||
<syntaxhighlight lang="cpp">#include <fstream> |
<syntaxhighlight lang="cpp">#include <fstream> |
||
#include <cstdio> |
|||
int main() { |
int main() { |
||
constexpr auto dimx = 800u, dimy = 800u; |
constexpr auto dimx = 800u, dimy = 800u; |
||
⚫ | |||
using namespace std; |
|||
⚫ | |||
⚫ | |||
⚫ | |||
for (auto j = 0u; j < dimy; ++j) |
for (auto j = 0u; j < dimy; ++j) |
||
for (auto i = 0u; i < dimx; ++i) |
for (auto i = 0u; i < dimx; ++i) |
||
ofs << |
ofs << static_cast<char>(i % 256) |
||
<< static_cast<char>(j % 256) |
|||
<< static_cast<char>((i * j) % 256); |
|||
⚫ | |||
ofs.close(); |
|||
return EXIT_SUCCESS; |
|||
⚫ | |||
=={{header|Common Lisp}}== |
=={{header|Common Lisp}}== |
||