1. Member
Join Date
Oct 2008
Posts
31

## Matrix Program

I have a test of informatics tomorrow and I think it will drop those two programs involving matrix, but do not know them.
If anyone can help me now I'll be thankful!

The programs are,
1. Show the sum of all the elements contained in the Matrix
2. Show the highest number in the matrix pair

* Note: the arrays do not have a fixed number of row and column. The user of the program is one who will determine it.

2. Member
Join Date
May 2008
Posts
2,302

## Re: Matrix Program

Well, you scroll through the entire array you'll have to go 2 bonds of repetition (for the first and second column for lines) aid within the innermost loop you make the operation of a variable sum (in order to accumulate the result).

3. Member
Join Date
May 2008
Posts
2,015

## Re: Matrix Program

What Zecho said it should be like the program, but before you go looking for solutions, get ready to try the program yourself. It is not difficult.

It is not good to decorate this type of thing, you have to understand is what to do and implement the structures you know.

4. Member
Join Date
May 2008
Posts
2,302

## Re: Matrix Program

@ Katty

I am still facing great difficulties in algorithms...this is pretty simple. If you do some simple examples it gives you a good understanding. But always took on algorithms bomb! Failed in the first year and spent "on the tin" in the second.

But it's always good to have the basics. Browse through the array, is supposed to make up with only 1 tie. Aid to lose but if I say grace (2 lessons led to us not find the answer and give teacher ...)

@ Zidaan

If you follow the advice of Katty it will be surely beneficial for you. You may require quite more practice. Mathematical algorithms are nearly identical, only need to learn the tricks by practicing.

5. Member
Join Date
May 2008
Posts
2,015

## Re: Matrix Program

I was curious. I do not know that.
But suspect. This works in any language or only in C.

6. Member
Join Date
Jan 2008
Posts
1,521

## Re: Matrix Program

In any language you can scroll through a matrix with a single case, it suffices to know the total quantity of items in the matrix.

And algorithms, in itself, an issue that many resent, but that the gang is not humble.

I had a professor of physics who use to say that the important thing is be humble. And this teacher taught a technique for solving problems of physics that I most looking forward & applied in all other areas and believe that can be used in any situation.

Come on:
1 - what's the problem?
A: In that case the problem was to show the sum of all items included in the matrix.

2 - I know the theory?
A: I know that matrix is used to scroll through 2 bonds of repetition, I know that a variable can be added using the operator + =.

3 - How can I use the theory to solve the problem?
A: If a parent can be run using two strings of repetition I can get a variable and for each item of the matrix I can add in the form of variable + = array [i] [j].

Thus it is possible resolve any problem in 3 easy questions. People who have difficulties with algorithms and can not solve the problem or using these forms, that is a problem in some of the items, or unable to interpret the issue, or does not have enough theory to solve the problem (and therefore worthy of reproach years) or do not have enough experience to know how to apply the theory to solve the problem. This experience can be acquired only with practice. Passing a whole year in classroom and not practiced during the entire time in the race also deserves to have another year of practices

7. Member
Join Date
May 2008
Posts
2,015

## Re: Matrix Program

Originally Posted by Modifier
In any language you can scroll through a matrix with a single case, it suffices to know the total quantity of items in the matrix.
I do not know if this is true, I am almost sure that some language criticizing it.

In Pascal, for example, it displays an error message of "Array Index out of bounds" or some "overflow" (or something, do not remember for sure), so I asked if it was in C.

I will kill the curiosity of the people.

In a 2x2 matrix:

1 2
3 4

Although the figures are in different "lines", in memory they are in following positions:

1 2 3 4

Thus knowing the total quantity of items you can read them all.

8. Member
Join Date
May 2008
Posts
2,302

## Re: Matrix Program

It really is possible in any programming language.

I had the algorithm here, but I will make a search. I recall that has to do with using "mod" in both indices of the array.

For example, if the matrix is 3x3 the sequence would look like this:

00
01
02
10
11
12
20
21
22

But remember not to head the algorithm...you speak the truth or tried, but as this is the teacher who taught...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•