PSX5Central

Non Gaming Discussions => Off-Topic => Topic started by: PS2_-'_'-_PS2 on January 22, 2003, 03:45:18 PM

Title: Visual Basic hell...
Post by: PS2_-'_'-_PS2 on January 22, 2003, 03:45:18 PM
hi, i need to code this program for skool but there is a bit that i am finding incredibly bloody hard!

-The program takes in 6 \'scores\' and stores them in an array.
-Then using parameters and parameter passing(you have to use them evenalthough it woulld be simpler without) i have to find the maximum and the minimum score in the score array.

So does anyone have an old example of this or anything similar gathering dust in a file somewher, if so please post it. =]
Thanks.
i spent 3 hrs 2nite trying to do this and i still cant get the shit to work !!!!
help please if u can...
Title: Visual Basic hell...
Post by: The Stapler on January 22, 2003, 04:03:32 PM
VB = teh easy!

(in a module)

Global intScore(0 to 5)

(in the program)

for i = 0 to 5
intScore(i) = txtText(i).text
next i

dunno the rest (too long to code)
Title: Visual Basic hell...
Post by: EmperorRob on January 22, 2003, 06:27:56 PM
(My VB is rusty)
I could show you how to do it in C but that probably wouldn\'t help you.  If you have Visual Studio search the help menus for functions like min and max.  The one good thing I can say about VB is its help docs.
Title: Visual Basic hell...
Post by: PS2_-'_'-_PS2 on January 23, 2003, 10:09:15 AM
the guy i bought VB from still hasnt given me the help cd, ill have to get it from him sometime =]. I got told how to do it today anyway. you have to pass the whole array to the function before it will work. i hate VB! =]
Title: Visual Basic hell...
Post by: The Stapler on January 23, 2003, 05:13:30 PM
I don\'t really know of any languages that are easier than VB :)
Title: Visual Basic hell...
Post by: Avatarr on January 23, 2003, 11:59:19 PM
OMG VisualBasic! I don\'t know how you can look at it and not puke. The second you see the first global variable (which is very common in BASIC source code), you should turn arround and look somewhere else! AAHAAAAAHHHHHHHHHHH. I think C++ is a lot easier to look at.

Anyhooo....  why can\'t u just write a function and pass the entire arry to it?
Title: Visual Basic hell...
Post by: square_marker on January 24, 2003, 02:21:18 PM
i could do it easily in delphi but i dont think that would help you out much.

here goes anyway


type
atype:=array[1..6]of integer;

var
testscores:atype;

procedure high_low(var testscore:atype);
  var
 high,low:integer
     ct:integer;
        begin
           for ct:=1 to 6 do
           begin
             high:=length(testscores[ct])
             low:=revlength(testscores[ct])
          end;
        end;

   procedure print_data(testscores:atype);
     begin
      writeln(\'High score is \', high);
      writeln;
      writeln(\'Low score is \',low);
     end;


begin
high_low(testscores);
print_data(testscores);
end.


of course you might wanna get the info keyed in or through an infile    

hope that might give u some help.... my teacher told me that once you learn one language, all the others are no problem.
Title: Visual Basic hell...
Post by: EmperorRob on January 24, 2003, 02:57:38 PM
Try using the code tags for that.

Ex:
[b]int[/b] hi = 0, low = 0;
[b]int[/b] numbers[10];

for (i=0; i < 10; i++) {
   numbers[i] > hi ? hi = numbers[i] : ;
   numbers[i] < low ? low = numbers[i] : ;
}
Title: Visual Basic hell...
Post by: PS2_-'_'-_PS2 on January 24, 2003, 05:27:21 PM
I eventually got it so its cool now, Thanks anyway guys.
I only have to write the evaluation and the algorithm now then im finished(!) =]
Title: Visual Basic hell...
Post by: Avatarr on January 25, 2003, 12:26:25 AM
thats a bit of a hoochoo. you write the algorithm before you code? you\'re going backwards in time little boy@! always write ur algorithm first@!
Title: Visual Basic hell...
Post by: PS2_-'_'-_PS2 on January 26, 2003, 02:24:47 PM
If u use \'bottom up design\' u write the code first i know it seems strange but there must be some advantages to the method. Anyway im not using that method, i meant i had to amend my algorithm coz a lot of things had changed =]. Anyway i have more important things on my mind now like my bloody English prelim 2morrow!!! =]
Title: Visual Basic hell...
Post by: Avatarr on January 26, 2003, 06:54:55 PM
yeah well, if you had a good algorithm to begin with you\'d have more time for that english prelim 2morrow. :P

Oh whell, GL. I guess u need it.
Title: Visual Basic hell...
Post by: PS2_-'_'-_PS2 on January 27, 2003, 07:53:50 AM
thats a good point. The prelim didnt go 2 badly but maths is on wednesday and is gonna be impossible! =]