User input for array size.
I haven't done any programming in since I took CS1100 last year. Now I am taking CS1110 and I don't want to get owned, so I am trying to practice some exercises from the book before my professor assigns anything.
So I am currently stuck with this part of a program--I want to be able to creat an array, the size of which is based upon the input of the user.
This is what I have right now. It doesn't work for obvious reasons but I can't figure anything out to work around it. (I don't know why the indentation is all weird)
cout << "Please enter the number of salespeople./n";
cin >> n;
const int * const sPtr = &n;
int salaryarray[ *sPtr ];
I have never used pointers until today, and I am very rusty with arrays. I understand that arrays have to have a constant value as their size. But there has to be a way to make that size be specified by the user. Right?