Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > General Gambling > Computer Technical Help
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-06-2005, 03:58 PM
mscags mscags is offline
Senior Member
 
Join Date: Mar 2005
Location: Between Two Hot Twins
Posts: 713
Default 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];
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.