<pre>#include <iostream> using namespace std; int main() int main() { int size; while (true) { cin >> size; if (size >=5 && size <=50) { break; } } int a[size]; for (int i = 0; i < size; i++) { cin >> a[i]; } for (int i = 0; i < size; i++) { cout << a[i] << ", "; } cout << endl; for (int i = size -1; i > 0; i--) { cout << a[i] << ", "; } cout << endl; int b[size]; for (int i = size -1; i > 0; i--) { if (i%2==0) { b[i] = a[i] * 2; } else { b[i] = a[i] * 3; } } for (int i = size -1; i > 0; i--) { cout << a[i] << ", "; } cout << endl; int c[size * 2]; for (int i = 0; i < size; i++) { c[i] = a[i] * 2; } for (int i = 0; i < size; i++) { c[i+size] = b[i] * 3; } for (int i = (size*2) - 1; i > 0; i--) { cout << a[i] << ", "; } cout << endl; return 0; } }
The error is expected initializer before 'int'. So I programmed many programs like this and it's the first time I'm getting this error. I don't understand why. Can someone please help me?
main
#include <iostream> using namespace std; int main() int main() {
main()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)