Basic programming with Pseint (part 2)

This entry is a continuation of the previous entry (Basic programming with Pseint (part 1)) and is part of a series of tutorials on programming.

In order to program it is necessary that Pseint has been configured correctly, if everything is correct we can continue with this tutorial that is directly focused on learning how Pseint works in order to start with the programs.

pseint

Once started we will see the following parts:

  1. Commands: (it is the one on the left) in which are the most basic cycles, functions and / or conditionals.
  2. Status bar: (the one at the bottom where it says "No updates available") this bar indicates the current status of Pseint.
  3. Work area: it is the largest part, this is where we will write our program.

These are the main ones, the others will not be very useful for the moment

ALGORITHM IN PSEUDO-CODE

Untitled process action 1; action 2; ... ... ... action n; End Process

This is the general form of an algorithm, as you can see, it begins with "Process [SinTitulo]" which indicates the start of the program and ends with "EndProcess" which indicates that the program has ended.

VARIABLES

Variables are sectors of memory that store specific data and are identified with a specific name that refers to these memory spaces. In Pseint you can define variables in the following ways:

With the equal sign so that «a» is the variable that receives the value of adding «c» plus «b»

a = c + b;

The other way is with the assignment sign (which we will see later, at the moment we only need to know it) and it is similar to the previous one with the difference that it is a different sign

a <- b + c;

These signs do not request any value from the user to know what value to place since this is done with the «read» function

ARRANGEMENTS

An array is sequences of multidimensional variables which can be stored in the form of a board or cube, in which the variables are called by a general identifier and a number in the Cartesian plane system. In Pseint, arrays are defined with the "dimension" function that we will also see later.

In this case the general identifier would be var y and the number would be "x" and "y" which could be [1,1] or [2,1], etc.

Dimension var [x, y]

Then to call the variable you would use

 var [x, y]

Where "x" could be 1 and "y" could be 2 then it would be calling "var [1,2]" which would be independent of "var [1,1]", etc.

OPERATORS

The operators as their name implies are signs that use some values ​​to give a result, The operators in Pseint are the following:

  1. Greater than ">"
  2. Less than «<«
  3. Same as "="
  4. Less than or equal to «<=»
  5. Greater than or equal to "> ="
  6. Different than «<>»
  7. Conjunction (and) "And" or "&"
  8. Disjunction (or) «OR» or «|»
  9. Denial (no) "NO" or "~"
  10. Add "+"
  11. Subtract «-«
  12. Multiplication "*"
  13. Division "/"
  14. Empowerment «^»
  15. Modulus (remainder of a division) «%» or «MOD»

The hierarchy (the order) of operations are the same as those of algebra and are alterable with parentheses. In the case of logical operators, the operation is short-circuited, the operator "NOT" inverts the result.

In this list only the ones to be used are mentioned, to see the complete list you can go to the PSeInt documentation.

FUNCTIONS

In programming, a function is a series of instructions that give a specific result and that can receive some value to carry out the task they must carry out. In Pseint a function is written as follows:

SubProcess [return variable] <- [Function name] ([Arguments]) action 1; action 2: ... ... ... action n; End SubProces

Well and that's it in the next tutorial I will focus on the rest of the functions and their syntax except for the operators mentioned here since their syntax is almost obvious.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   glcq said

    Thank you very much for sharing these tutorials, they are very interesting.

    1.    xnmm said

      there is no reason and at once I say that the next one is already dedicated to programming
      regards

  2.   porter said

    Thank you for sharing, this program I already knew, I discovered it in sourceforge and it is very good, it will be useful to me because even if I do some programming, I do it without specific knowledge about terms etc, and I come from an area that has nothing to do with it as it is humanities So these classes are very good for giving easy ideas about programming content, because if you are like me completely ignorant of the thing, terms like classes, variables, which are basic are things that for people without knowledge of basic programming are things without an image or unknown concepts, in this sense this program is very good. Thank you for sharing and I put a pin in my Bookmarks. Regards.

    1.    spartan2103 said

      I think similar to Portaro. I also come from the Humanities area and although I know something about programming, I do it more lyrically, without much knowledge of the facts, Thanks for the tutorials. By the way, are you the Portaro who posts in Gnu / Linux Vagos?

  3.   spartan2103 said

    I think similar to Portaro. I also come from the Humanities area and although I know something about programming, I do it more lyrically, without much knowledge of the facts, Thanks for the tutorials. By the way, are you the Portaro who posts in Gnu / Linux Vagos?