I wrote the following code on visual studio and it says "expression did not evaluate to a constant" for [numWashes]
on line 20, however when I try it on other compiler it works, how can I fix this?
#include <iostream>
#include <fstream>
using namespace std;
struct WashData {
int membershipStatus;
int carSize;
int washType;
int additionalService;
double totalCharge;
};
int main() {
int getNumWashes;
cout << "Enter the number of car washes: ";
cin >> getNumWashes;
const int numWashes = getNumWashes;
// Create an array of WashData structures
WashData washes[numWashes]; //line 20 **error**
return 0;
}