I still have no idea what im doing wrong. I cant seem to make it work.
Can anyone point me to the right direction please.
User Profile
Collapse
-
Parallel array
Hello!
Im learning arrays and am having trouble with parallel arrays. I dont understand exactly what they are. Can anyone give me an explanation of what they are or maybe how they can be declared or a small example...anyth ing to help me understand parallel arrays?
Thank you. -
Ok, I have been working and adding more things to my code. I think Im getting a little confused again on some parts though...maybe even complicating it more than it should be.
This is what im trying to do: (i split it into sections to make it understandable)
1. I want the user create an array of up to 100 positive numbers with the use of
-1 to stop entering if the user needs an array containing less than 100...Leave a comment:
-
hehehe...thank you. I guess ive been staring at the computer screen for the longest that i cant see the small mistakes anymore.
Hey by any chance do you know if there is a way to make two copies of an array. For example, If i wanted to make two copies of the data inputted by the user in the above array? If so, how could that be done. I think I read somewhere that it could be done but dont know how and ive tried looking it up online...Leave a comment:
-
Oh, ok. I see how to define the array now. Yes, you are correct...I was somewhat confused. Thank you SammyB for your help.
I just have another question. I added another loop at the end of the code to display my output. But, everytime i run the program...it doesnt display it.
This is what i added:
...Code:Console.WriteLine("x1" & vbTab & "x2") For j As Integer = 0 To array.GetUpperBound(0)Leave a comment:
-
Ok i decided to go another way with this problem and this is what i have so far:
...Code:Dim numbers As Integer 'An array for storing the input values. Dim numCt As Integer() 'The number of numbers saved in the array. Dim num As Integer 'One of the numbers input by the user. numbers = New Integer(0 To 99) {} <<---I get an error here saying Value of type '1-dimensionalLeave a comment:
-
For i As Integer = 0 To array.GetUpperB ound(0)
Console.Write(i & vbTab & array(i))
Next
This gives me the 100 positive numbers in the array but what i wanted to do was to have the user input the numbers
For example:
Please enter the value (-1 to stop):
6
Please enter the value (-1 to stop):
4
Please enter the value (-1 to stop):...Leave a comment:
-
Declaring an array
Hi!
I dont understand arrays very much. Im trying to create an array of up to 100 positive numbers with the use of -1 to stop entering if the user needs an array containing less than 100 elements.
Ive seen them declared many ways but since im want to create an array of up to 100, Im using the following:
...Code:Dim array as integer() Array=new integer (0 to 100) {} Console.Write("PleaseLast edited by Killer42; Mar 14 '07, 02:01 AM. Reason: Please use CODE.../CODE tags around your code.
No activity results to display
Show More
Leave a comment: