I need help fixing this error. It is saying that X needs to be a constant. I have tried re-writing int x=0 as const int x=0, but it shows another error saying that x can't be constant. Does anyone know how to fix this error? So far, it is the only one in my code.
int main()
{
    int x = 0;
    ifstream inputFile; 
    inputFile.open("systemsprices.txt");
    string temp;
    while (!inputFile.eof()) { 
        getline(inputFile, temp); ++x;
    }
    x /= 2;
    string console[x]; //this x has an error
    float price[x];    // this x has an error
    loadArrays(console, price, x);
    while (1) 
    {
        int choice = showMenu();
        switch (choice)
        {
        case 1: showArrays(console, price, x); break;
        case 2: lookUpPrice(console, price, x); break;
        case 3: sortPrices(console, price, x); break;
        case 4: highestPrice(console, price, x); break;
        case 5: exit(0); break;
        }
    }
}
