5x5 Matrix with Portugol - Learning to program

Asked

Viewed 573 times

-6

I’m a student and I’m starting to learn about programming, I have an exercise that I couldn’t solve myself and I was wondering if anyone here could help me, with the solution and/or with an explanation so that I can understand this and try to solve other similar to this by myself.

I need a algorithm in Portugol, which has a 5x5 matrix where each position represents a city: A,B,C,D,E each with a predefined distance I must put by which cities I went (walk through the matrix) then tell the distance traveled , and/or the distance from one city to the other.

Reference:

https://vinyanalista.github.io/portugol/

  • 2

    Welcome to Sopt! A community focused on helping solve specific problems related to software development and the like. I guess this isn’t the best place to ask someone to do their college work. ;)

  • The only problem is looks like (I’m not saying it’s) that you haven’t shown any research effort, it kind of makes the folks here kind of upset at answering this kind of question, but it’s totally valid your question, it’s clear, it’s well-defined in terms of middle and end summing up is a question about legitimate programming, do not know why they are voting to close it, the minimum example, complete and verifiable that they are using to justify the closure this being used in the wrong way, the minimum is the pseudo code, complete is the explanation of the problem and verifiable would be the part that someone could help you

  • some people can not see that the minimum, complete and verifiable example is not always written in source code form, and this is a community error that needs to be adjusted as soon as possible, so that we can expand the number of people using SOPT

1 answer

3


Beauty come on

algoritmo
declare mat[5,5], resultado[5,5], i, j, distancia numerico
para i <- 1 ate 5 faca
inicio
    para j <- 1 ate 5 faca
    inicio
        leia mat[i,j]
    fim
fim
distancia <- mat[1,1]
para i <- 1 ate 5 faca
inicio
    para j <- 1 ate 5 faca
    inicio
        se mat[i,j] > distancia entao
            distancia <- mat[i,j]
    fim
fim
para i <- 1 ate 5 faca
inicio
    para j <- 1 ate 5 faca
    inicio
        resultado[i,j] <- distancia * mat[i,j]
    fim
fim
para i <- 1 ate 5 faca
inicio
    para j <- 1 ate 5 faca
    inicio
        escreva resultado[i,j]
    fim
fim
fim_algoritmo.

// Adaptado de:
// ASCENCIO, A. F. G.; CAMPOS, E. A. V. Fundamentos da programação de
// computadores. 2a. ed. São Paulo: Pearson Prentice Hall, 2007. p. 198.

And now when someone asks something of this code you will know how to answer ? My tip is to see where you have doubts, post a question or a problem that is verifiable so that colleagues here can give solutions ;)

  • 2

    Thank you very much! About what you commented on in my question.. I think that this community would be kind of a forum and could help me, I’m not Einstein, I’m new at programming.. I am very upset about this, it seems that here people give negative vote to f**** with whom the question.. The way is to delete/forget the account and leave this community, thanks really for the help!

  • 1

    Enter my profile there.. Only question with negative vote! I’m new here, but I found this "community" (because this for me is not to be called community) kind of hypocritical.. They don’t know how to hit you with people, they can’t hit you with "idiot" questions, if that’s a question, even if it’s the dumbest thing, that’s a question. I really did not like this "community", and I prefer much more forums that there is moderation and are common people, be beginners until experienced.

  • There’s a place here called meta where we debate topics that guide everything that happens here, there is where it is supposed to decide what is worth and what is not worth, It has been discussed whether here is a good place for those who want to start learning to program a pass there and leave your message to the others will be important they see that a lot of thing they say there in practice does not happen here http://meta.pt.stackoverflow.com/questions/4818/stackoverflow-n%C3%A3o-%C3%A9-a-good-op%C3%A7%C3%A3o-para-quem-quer-come%C3%A7ar-a-programar

  • @STRILEXLIVE understands your frustration, I have looked at your questions and I have seen that some negative votes do not make sense, but do not take that personally, the negative votes are a signal to the author that there is something wrong with the question and that the content can be improved. Regarding the question of this topic, I agree with the negative votes, you simply asked someone to do your job. You say that Sopt doesn’t seem like a community and you’re right, it alone is not a community, to be such depends on the behavior of the people who attend here...

  • @STRILEXLIVE ... soon becomes a community when its users behave properly, that is, their behavior expecting others to solve their problem without any effort on their part (at least it is the idea I have when reading your question) does not collaborate for Sopt to be a community, you failed on your part. Take this as a constructive criticism, everything is a matter of action-reaction.

  • @Filipemoraes really you are right about my question, but I only did it because a friend of mine was with this doubt and I decided to help, and as I know nothing about Portugol... Look aew http://prntscr.com/ah00p8 http://prntscr.com/ah00xe

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.