Hello, I am a pretty basic C++ programmer, just a few high school classes, but I am sttempting to write a coding program, I want to make a interger array of a user specified amout of units.
Segment of Code
_________________
cout << "Input Your Code

" << endl << endl;
getline (cin, code);
int length = code.length();
int location[length] = {0};
____________________
It is giving me the error that there must be a constant expression in the brackets to create the array. I remember in my class makeing many arrays without having constant varibles to decide the length. My entire code is below, if you see a problem or know an alternate way to make an interger array the same length as the string "code" your help would be very thankful.
*note* Code not complete, and I know the way I'm includeing apstring.h is not very effecient, I am just being lazy for such a small program.
____________________
#include<conio.h>
#include<iostream.h>
#include<apstring.h>
#include<apstring.cpp>
void main(){
int count=0;
int x=0;
int y=0;
apstring code;
char key[5][26] = { {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'},
{'M', 'B', 'C', 'Z', 'L', 'J', 'G', 'D', 'A', 'P', 'I', 'Y', 'R', 'W', 'N', 'V', 'X', 'K', 'H', 'F', 'S', 'O', 'U', 'T', 'E', 'Q'},
{'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M'},
{'Z', 'Y', 'X', 'W', 'V', 'U', 'T', 'S', 'R', 'Q', 'P', 'O', 'N', 'M', 'L', 'K', 'J', 'I', 'H', 'G', 'F', 'E', 'D', 'C', 'B', 'A'},
{'F', 'Q', 'J', 'A', 'D', 'W', 'T', 'M', 'H', 'B', 'Z', 'R', 'X', 'O', 'Y', 'P', 'K', 'G', 'C', 'L', 'N', 'S', 'U', 'I', 'V', 'E'}};
cout << "Input Your Code

" << endl << endl;
getline (cin, code);
int length = code.length();
cout << endl << length << endl;
int location[length] = {0};
while(count<length){
y=0;
while(y<26){
if(code[count]==key[0][y]){
location[count]=y;
}
y++;
}
count++;
}
return;
}
______________________
Thank You!