Basically, what this program is supposed to do is input NP names, of length 1 to 14 from a text file. However, when I run the program, I get 3 errors on the line 'char strName[NP][15];' They are:Code:#include <iostream.h> #include <fstream.h> int main () { ifstream fin ("gift1.in"); ofstream fout ("gift1.out"); int NP; fin >> NP; char strName[NP][15]; int i; for (i = 0; i< NP;i++) { fin.getline(strName[i],20); } return 0; }
error C2057: expected constant expression
error C2466: cannot allocate an array of constant size 0
error C2133: 'strName' : unknown size
Thanks in advance for any help
{EDIT: The number input for NP is 5}