How To Make The Simplest Program In

Table of contents:

How To Make The Simplest Program In
How To Make The Simplest Program In

Video: How To Make The Simplest Program In

Video: How To Make The Simplest Program In
Video: how to make a simple program 2024, December
Anonim

When learning to program, the user goes through stages similar to when learning to speak. First, he learns the basics of the language, then writes the simplest programs.

How to make the simplest program
How to make the simplest program

Instructions

Step 1

Choose which programming language you want to learn first. In regard to this, the opinions of specialists differ. Some believe that it is best to start with languages specially created for educational purposes: classical (Basic, Pascal) or modern (Scratch). Others believe that after learning any of these languages, a programmer can stop developing in the future without starting to learn more complex ones. They recommend starting right away with professional languages: C, C ++, C #, PHP, Perl, Python, Ruby, etc.

Step 2

If you have chosen the BASIC language, get interpreters for this language both on your computer and on your phone. Install the UBASIC interpreter on the first, and MobileBasic on the second. Both are free. To run the first, you need a computer with a DOS emulator, for example, Dosbox, and in order to use the second, a phone with J2ME support is enough. Thus, you can learn to program away from your computer.

Step 3

Examine the commands of each of the interpreters. Please note that there is no common standard for the Basic language, and the same actions in different interpreters are performed slightly differently. In UBASIC, enter the HELP command to display a list of operators. In MobileBasic, select the Help item from the Options menu, then select one of the operators. It will appear on the screen along with templates of all parameters - all that remains is to replace them with the required ones.

Step 4

To enter a string, first dial its number and then the content. The line will be located to the program code after the nearest line with a lower number, but after the nearest line with a higher number. For convenience, assign numbers to the lines in multiples of 10 so that you can insert intermediate ones between them, if necessary.

Step 5

To save the program, use the command:

SAVE "PROGNAME" To start it, use the command:

RUN To view the typed program, use the command:

LIST To clear program memory, and in some interpreters, all variables, use the command:

NEW

Step 6

For example, type the simplest program in the MobileBasic interpreter: 10 INPUT A%

20 INPUT B%

30 C% = A% + B%

40 PRINT C%

50 END After starting it will ask you for the value of the variables A% and B%, add them and assign the value of the sum to the variable C%, and then display its value. If UBASIC is used instead of MobileBasic, remove the percent signs throughout the program.

Recommended: