Task: | Fraktaali |
Sender: | valokoodari |
Submission time: | 2017-10-05 18:39:31 +0300 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:9:23: error: variable-sized object 'f' may not be initialized char f[m][m] = {{'#'}}; ^
Code
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n; m = (int)pow(2, n-1); char f[m][m] = {{'#'}}; for (int i = 1; i < n; i++) { int l = (int)pow(2, i)/2; for (int j = 0; j < l; j++) { for (int k = 0; k < l; k++) { f[l+k][j] = f[k][j]; f[k][l+j] = f[k][j]; if (f[k][j] == '#') { f[l+k][l+j] = '.'; } else { f[l+k][l+j] = '#'; } } } } for (int i = 0; i < m; i++) { for (int j = 0; j < m; j++) { cout << f[i][j]; } cout << endl; } }