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!

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

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

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...

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

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.....

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

How do you study then ?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.