Visual BASIC array problem?
-
I am having some issues with a homework problem setting up a 1-D array. I am trying to set up an array where the user can input names of people and in the same array input a score ...show more
-
Answer:
That's not a one-dimensional problem. In a lanuage where you can define the index to an array, you could use the students' names as the index and their grade as the value stored... BUT Visual Basic arrays are indexed (as most current languages are) from 0 to one less than the number of entries they hold... so in a single dimensional array you can't hold both a name and a score... unless you append name and score together into a single string, storing them in an array of strings. If you did that (and I do not recommend it), you would need a way to tell where the name stops and the score starts so you could split them back up and interpret them each time you use them. It's considered bad practice but it is certainly possible. What we've normally done since, maybe, the 1980s, is instead create either a multidimensional array or -- since you'd be storing two types of data values -- create two single dimension arrays: one would hold names and the other would hold the numeric score values -- and using the corresponding score value for any person would just require finding their name in the name array and accessing the cell with the same index number in the score array. Your assignment specifies _a_ 1-D array but perhaps it would be allowable to do it this way, if you're allowed to use more than one array as long as any array you use is one dimensional.
XTL7C7FS5DHHUZW74ZL6BEH2FQ at Yahoo! Answers Visit the source
Related Q & A:
- What are the object-oriented features of Visual Basic.NET?Best solution by msdn.microsoft.com
- Can you program Graphics with Visual Basic?Best solution by Yahoo! Answers
- What are the main parts of visual basic 2005?Best solution by msdn.microsoft.com
- Codes for a simple visual basic program.Best solution by vbtutor.net
- How do you use the Contains Function in Visual Basic?Best solution by go4expert.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.