Creating Variables on the fly

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 26
Reputation: Church is an unknown quantity at this point 
Solved Threads: 1
Church Church is offline Offline
Light Poster

Creating Variables on the fly

 
0
  #1
Oct 14th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Creating Variables on the fly

 
0
  #2
Oct 14th, 2007
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.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 26
Reputation: Church is an unknown quantity at this point 
Solved Threads: 1
Church Church is offline Offline
Light Poster

Re: Creating Variables on the fly

 
0
  #3
Oct 14th, 2007
oh duh, i feel stupid.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC