944,008 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1513
  • C++ RSS
Oct 14th, 2007
0

Creating Variables on the fly

Expand Post »
well i'm a bit of a beginner programmer.. i've taken a few classes but every time i look at a piece of code i get lost easily.

But i do have a question..

I was reading this visual basic book and there was this thing about listing all of these record in order.. kinda like a bunch of arrays.. and organizing them by a certain field.

Well i got to wondering.. all though this would probably be easier if written to a file and taken out one record at a time i guess..

Is it possible to make a variable on the go?

Like say i made a for loop and i only wanted to declare a variable if Something was true, and that changed every time i ran the program. So like a For loop that ran through 100 times. And whatever was true 25%, 50% and 75%

then i'd only want 25 variables, 50 variable then, 75 variables..

so would i be able to make something where i created something like

Variable 1
Variable 2
Variable #

and so on until i didn't need anymore, and then i could easily sort records, and i'd imagine the program would run faster overall. Although i really have no idea i'm more just curious whether it's possible.

Oh and sorry if this is hard to read i'm having trouble expressing my question.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
Church is offline Offline
26 posts
since Oct 2007
Oct 14th, 2007
0

Re: Creating Variables on the fly

No, no no no.

It's called using an array. And you populate whatever is true.
Last edited by iamthwee; Oct 14th, 2007 at 9:25 am.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Oct 14th, 2007
0

Re: Creating Variables on the fly

oh duh, i feel stupid.
Reputation Points: 10
Solved Threads: 1
Light Poster
Church is offline Offline
26 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Help with counter-controlled loop to find average
Next Thread in C++ Forum Timeline: graphics in c++





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC