#include #include #" /> #include #include #" /> #include #include #"/>

Got an Error declaring vector - expected expression

1.4k Views Asked by At

Got an Error "expected expression" in line 15. Don't know what it needs and how to solve it.

#include <iostream>
#include <vector>
#include <string>
#include <set>

using namespace std;

int main() {
    int q;
    cin >> q;
    string command, task;
    int day;
    int index = 1;
    vector<int> m_Lenght;
    m_Lenght = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31}; //<-- Here in line 15
    return 0;
}
1

There are 1 best solutions below

0
Vlad from Moscow On

Compilers before adopting the C++ 11 did not support the initialization of containers using std::initializer_list. There were no initializer list constructors.

So either use a more modern compiler or select the option of your compiler that allows to use features introduced in the C++ 11.