Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <Windows.h>
- const int Size = 30;
- const int LSize = 3;
- const int TSize = 40;
- int Init[Size][Size][Size], Temp[Size][Size][Size];
- DWORD Real = 0;
- void main()
- {
- int x, y, z;
- for (x = 0; x < Size; x++)
- for (y = 0; y < Size; y++)
- for (z = 0; z < Size; z++)
- {
- if (x > (Size - TSize) / 2 && x <= (Size + TSize) / 2 && \
- y > (Size - TSize) / 2 && y <= (Size + TSize) / 2 && \
- z > (Size - TSize) / 2 && z <= (Size + TSize) / 2)
- Temp[x][y][z] = 30;
- else
- Temp[x][y][z] = 0;
- if (x > (Size - LSize) / 2 && x <= (Size + LSize) / 2 && \
- y > (Size - LSize) / 2 && y <= (Size + LSize) / 2 && \
- z > (Size - LSize) / 2 && z <= (Size + LSize) / 2)
- Init[x][y][z] = 1;
- else
- Init[x][y][z] = 0;
- }
- HANDLE out = CreateFileA("F:\\Разное\\Проекты\\C++\\life\\InitialTemperature.init", \
- GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
- WriteFile(out, Temp, Size * Size * Size * sizeof(int), &Real, NULL);
- CloseHandle(out);
- HANDLE out1 = CreateFileA("F:\\Разное\\Проекты\\C++\\life\\InitialLife.init", \
- GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
- WriteFile(out1, Init, Size * Size * Size * sizeof(int), &Real, NULL);
- CloseHandle(out1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement