Any computer programmers on this forum?

Buellxb Forum

Help Support Buellxb Forum:

1stxb9r

Well-known member
Joined
Apr 10, 2009
Messages
341
i have three different question for anyone who can help,
1. does a parallel array store another array as each element?
2.can only whole number be used as array subscripts?
3.in a loop
rep = 10
while (rep < 20)
print "error"
endwhile
is the loop control variable not initialized, loop control variable not altered, loop control variable not declared, or is the loop body totally missing?
ANY HELP WOULD BE GREATLY APPRECIATED!!
 
sounds like a hw assignment. I use matlab but I really dont know what that stuff means. I know what the code is doing but thats about it.
 
image211.gif
@ Dave.
 
I have no idea what you mean by parallel arrays, do you mean multi-dimensional arrays?
as in ARRAY[x][y]=z?

As far as using anything other then an integer for an array index... some languages may handle it, but most will not. typically a string or an integer. (that doesn't mean you cant convert a float to a string, but I have a feeling that isn't going to do you any good)

And for your loop, you never increment "rep" so you have a never ending loop.

Is there a particular thing you are trying to accomplish, or just providing an IT quiz?
 
Also should note that your syntax is f-ed up.. proper formation of a do-while loop in vb:

Do While (<comparison_test>)
<VB STATEMENTS>
Loop

in your example:
rep=10
do while (rep<20)
<whatever your trying to accomplish>
rep++
loop

(DISCLAIMER: It's been a long damn time since i've done anything in VB)
 
Buellysses, i am taking a programming logic and design class this semester. the three questions my prof marked wrong on my last test but agreed to give me the points if i could prove my answers to be correct. That is why i posted the 3 questions. thanks for the reply.[up]
 
1stxb9r said:
3.in a loop
rep = 10
while (rep < 20)
print "error"
endwhile
is the loop control variable not initialized, loop control variable not altered, loop control variable not declared, or is the loop body totally missing?
ANY HELP WOULD BE GREATLY APPRECIATED!!

So what did he mark as the answer for #3?
The loop control variable was not initialized, however, the variable does not have to be initialized in the loop. The loop control variable is definitely NOT altered.


kajer said:
python is the new basic
[up]
 
H-D Powertrain Thermodynamics Custom Software Solutions Engineer reporting for duty!

For multidimensional arrays the first array DOES store the other arrays internally as references, each element of the first array would return another array and the element in the returned array is the actual location of the information storage.

in VB.net from VS2005 or VS2008 I believe you have to build the multidimensional array in a fashion like so:

Dim exampleArray(5) as String
exampleArray(0) = New String(){"1", "2", "3"}

It would be much easier to use the System.Collections.ArrayList class and just populate the initial ArrayList with other ArrayLists so you don't have to deal with array sizing

like so:

Dim aL1 as ArrayList = New ArrayList()
aL1.add(New ArrayList())

for retrieving data:
r = row (first array)
c = column (second array)

aL1.Item(r).Item(c)
 
H-D Powertrain Thermodynamics Custom Software Solutions Engineer reporting for duty!

So how much VB coding do you do at HD?

Being in the Thermodynamics dept I assume your doing data logging/processing stuff, not coding the ECU software n stuff?
 
spymac, my prof didn't give me the answer[down], but the answer i choose for question 3 was LOOP CONTROL VARIABLE NOT INITIALIZED.
answer to 1 question is YES
answer to 2 question is YES (whole #/integers)
If i understood all you guys advice.
 
I have just been waiting for a thread like this!

Most of the stuff I do is with office interactivity, writing programs that work with the test results and collected data to graph in Excel or write reports in Word, generate Gantt charts in Project, and so on. I also do an extensive amount of database design and scripting (sql views).

We code mostly in VB.NET there (Microsoft windows is the business standard), but I also know C++, C#, Java, Python, and so on. H-D also has a department only for writing software and they use Java as their standard.

I don't just write stuff to data crunch, there is also a lot of planning and data network storage management applications I write.

Your answers: Yes, Yes, and loop control variable not initialized would all be correct.
 
Thorivola;
wouldn't the correct answer be "not declared" and "not altered" because he initialized the variable with the "rep=10" statement but didn't declare the variable first with a "dim rep as integer" statement. Also inside the loop he never increments the "rep" variable, so the WHILE condition is never satisfied.
 
i can't tell you guys how much this has helped:D[up]thanks alot. this has been my first programming class since my major is computer tech, but my concentration is information security.
 
Back
Top