How do you get the diagonal numbers?


  • QA Engineer

    Help me, please, Delphi mission:

    1. Create the annex: lay down the table 10x10. In the click on the button, fill the table, the table boxes are filled with numbers between 1 and 200, step 21.3.5.9, etc.
    2. Take out the numbers of auxiliary diagonals.

    I filled the table! But I don't know what condition it takes to get the diagonals out of Edit?



  • So, knowing from the history of the start of its programming, there are properties for a two-track set of equal-colored pillars and lines.

    I - line

    J - column

    N = bulb of elements in the line, or more accurately, if we have a binary matrix, and that's the one where the bulb is the ring of the poles. In your case, it's 10

    Further

        if I=J then элемент расположен на главной диагонали
        if I>J then элемент расположен под главной диагональю
        if I>J then элемент расположен над главной диагональю
    if I+J=N+1 then побочная диагональ
    if I+J<N+1 then над побочной
    if I+J>N+1 then под побочной
    

    These conditions shall be checked in the cycle

    for I:=1 to N do
      for J:=1 to N do
       Begin
        {условие}
         //ну и делать что нужно
       End;
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2