Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- class GoF {
- private:
- int neighbors;
- int pixel[10][10] = {
- { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
- };
- int i1;
- public:
- void Start_G(int n)
- {
- cout << 'f' ;
- for (int i1 = 0; i1 <= n; i1++)
- {
- for (int i = 0; i <= 9; i++)
- {
- for (int j = 0; j <= 9; j++)
- {
- neighbors = (
- pixel[i - 1][j - 1] +
- pixel[i - 1][j] +
- pixel[i - 1][j + 1] +
- pixel[i][j + 1] +
- pixel[i][j - 1] +
- pixel[i + 1][j + 1] +
- pixel[i + 1][j] +
- pixel[i + 1][j - 1]
- );
- if (pixel[i][j] == 0) {
- if (neighbors == 3) {
- pixel[i][j] = 1;
- }
- }
- else {
- if (neighbors != 3) {
- pixel[i][j] = 0;
- }
- }
- cout << pixel[i][j] << ' ';
- }
- cout << ' ' << endl;
- }
- }
- }
- };
- int main() {
- int n;
- cin >> n;
- GoF F;
- F.Start_G(n);
- system("pause");
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement