#1
|
|||
|
|||
C++ Question
Hi,
I'm trying to make a program and am having some difficulty with arrays. I need to let the user decide how many entries he wants to imput and then use that number as the size of the array. This is what my code looks like but I keep getting an error saying that I can't define my array that way. Is thee any other way to do this or am I just missing something very simple? Thanks for the help. const int Size = 13; int Entries; int Numbers[Entries], Names[Entries]; cout << "How many entries do you have?"; cin >> Entries; cout << "Please enter all of the names."; for (int i=0; i<Entries; i++) cin >> Names[i]; cout << "Please enter the phone numbers."; for (int i=0; i<Entries; i++) cin >> setw(Size) >> Numbers[i]; |
|
|