I copied this code from a working program I wrote in C++ and put it into Visual C++ and I get this error:
1 error C2057: expected constant expression
1 error C2466: cannot allocate an array of constant size 0
1 error C2133: 'resistors' : unknown size
int main(){
// Read from resistorlist file
int rNumber[2];
int number_of_resistors[100];
ifstream resistor_list;
resistor_list.open("C:/Users/Jeff/Dropbox/Programming/Cpp/textfiles/resistorlist.txt");
resistor_list >> rNumber[0] >> rNumber[1];
string resistors[ rNumber[1] ];
for ( int i = 0; i < rNumber[1]; i++ )
{
resistor_list >> resistors[i];
}
resistor_list.close();
cout << "Read from resistorlist.txt successful!" << endl;
}
What gives?
Thanks guys