0

Hi! Good day! can you help me with my assignment:

-Create a function that will accept values 0 and 1 in a 3 x 3 matrix.
-Create a function that will print values inputted to the 3 x 3 matrix
-Output should follow this format:
1 1 0
1 0 0
0 0 1

I'm not good in c++, I don't know where, how to start doing this program..thanks!

7
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by Rbezona
0

Read your lecture notes and read your textbook. Write simpler programs and grow them into something bigger with progressive, understandable modifications.

0

what computer language? Or can you use anything you wish?

I think c++:

I'm not good in c++,

But this could also mean that anything but C++ would do... hmm...

0

I think this may help a lil....
Take a two dimensional array and
Start filling it with required data using
some kind of looping mechanism.
now just print the contents of the array
using the same looping mechanism used
to fill the array....i think this might help you
if not much but very much.....
Have a nice day.....

0

yes, its c++...
we dont have any textbooks.
thanks for the reply! ^_^

How do you study then ?

0

abbey2589,

Here is some pseudo code to help you solve your problem.
use any language reference to convert to proper syntax for
your language of choice.

Hope it helps:


define integer X
define integer y
define char I
define matrix M (3,3)

X=0
Y=1
WHILE Y < 4
GET I
IF END-of-DATA
Y=4
ELSE
IF I < '2'
IF X < 3
X=X+1
M(Y,X) = I
IF X > 2
X=0
Y=Y+1
ENDIF
ENDIF
ENDIF
ENDIF
ENDWHILE
X=0
Y=1
WHILE Y < 4
X=X+1
I=M(Y,X)
PUT I
IF X > 2
PUT LINEFEED
Y=Y+1
ENDIF
ENDWHILE

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.