Jump to content

Urgently , I need help , i have an exam tomorrow plz

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
cipher

cipher

    Learning Programmer

  • Members
  • PipPipPip
  • 39 posts
hey guys
how are you doing ?
plz i need help in making a project using vb6 that adds two (2,2) matrices ,
so here's what i've done
Dim h(2, 2), r(2, 2), d(2, 2) As Integer

For i = 1 To 2

For j = 1 To 2

t$ = "a(" + Str$(i) + "," + Str$(j) + ")="

x$ = InputBox$(t$)

h(i, j) = Val(t$)

Next

Next

For i = 1 To 2

For j = 1 To 2

s$ = "b(" + Str$(i) + "," + Str$(j) + ")="

g$ = InputBox$(s$)

r(i, j) = Val(s$)

Next

Next

For i = 1 To 2

For j = 1 To 2

d(i, j) = h(i, j) + r(i, j)

Next

Next

For i = 1 To 2

For j = 1 To 2

Print d(i, j); "  ";

Next

Print

Next
the prb is that when i input my matrix numbers the summition is always printed as 0
plz help
thx all

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Are you sure your inputs are coming in correctly? I would do an output on those first.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
cipher

cipher

    Learning Programmer

  • Members
  • PipPipPip
  • 39 posts

WingedPanther said:

Are you sure your inputs are coming in correctly? I would do an output on those first.

i donno , i got a brainfreeze like on this matter coz i don't like vb6 , so , i really donno what's wrong

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Try printing out h and r arrays after inputting each of them. Also, do VB arrays go from 0-1 or 1-2?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
cipher

cipher

    Learning Programmer

  • Members
  • PipPipPip
  • 39 posts

WingedPanther said:

Are you sure your inputs are coming in correctly? I would do an output on those first.

thx man , i left the matter for a while cause i was bored to death from the whole vb6 scene then i revised the code and it was a stupid mistake , in my inputs of course , thx again

#6
cipher

cipher

    Learning Programmer

  • Members
  • PipPipPip
  • 39 posts

WingedPanther said:

Try printing out h and r arrays after inputting each of them. Also, do VB arrays go from 0-1 or 1-2?

VB arrays go from 0-1