Answer the question
In order to leave comments, you need to log in
What does the g++ compiler message mean when working with arrays?
Good day, I'm practicing with arrays in C ++. In general, it gives the following warning:
prg.cpp: In function 'int main()':
prg.cpp:9:11: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [ enabled by default]
int num[8]
The code itself is:
#include
#include
using namespace std;
int main()
{
int num[8]
{
1, 5, 4, 2, 7, 2, 1, 3
};
int a;
a = -1;
while (a < 7)
{
a++;
cout << num[a] << endl;
}
return 0;
}
Thanks in advance to all who answered!
Answer the question
In order to leave comments, you need to log in
From which book did you accumulate and paste the pieces? Did you enter a message into Google? Have you tried to translate?
It is written in white and white English - you are trying to use features from C ++ 11, but the compiler was not told about it.
And even the decision is written - the option needs to be added.
Place an = symbol between the array declaration and the array body specification. And use code formatting here. It's a button with three dots in the editor.
should be like this:
int num[8] =
{
1, 5, 4, 2, 7, 2, 1, 3
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question