What to choose - Nvidia or Radeon? Video cards
When buying a computer, the question of choosing a video card is acute. And everyone asks: which is better - ATI or Nvidia? I experienced in my own skin all…

Continue reading →

How to choose a tablet?
If you have a child, then such a question does not arise before him. The answer is obvious - exactly the same as the most advanced peers. But since you…

Continue reading →

Donald Davis Who invented the Internet?
Pushkin correctly said - we are lazy and inquisitive. And in any matter, without exception. Take, for example, the Internet. The one without which most of us no longer imagine…

Continue reading →

Can I start programming in 5 minutes? Is quite real

The topic of programming lessons has been raised more than once, but many of these materials are either too complicated for beginners or require additional preparation and installation of various (often expensive and time-consuming) software packages. Is it possible to do without all this? Can!

We will try to get by with a minimum of additional information, so that in 5 minutes our first program will work. So let’s get started. Introduction According to the encyclopedia, a computer program is a sequence of instructions for a computer. A programming language is a formalized way of writing computer programs. It is important to note that the computer itself does not need a “human” language; it copes well with machine codes in binary format. These codes are simple instructions like: “Take the number at address 100, add the number at address 101, put the result in cell 102”.

The first computers were programmed in this way, but for a person this method turned out to be extremely inconvenient, and already in the 50s of the last century programming languages ​​appeared that made it possible to record commands in a format that people understood. Any program consists of at least two components: Source code written in a programming language. A translator program that converts code into a sequence of actions performed by a computer. To create and debug programs, there are large and complex programming environments that occupy up to several gigabytes on the hard drive, but we will not need any of them. Moreover, we do not need anything at all – to write the simplest program, the tools that are available in the Windows operating system are enough. The browser included in the system has the ability to run Javascript programs, which we use. The advantage of Javascript is that it has a modern syntax that practically coincides with the C language, modern C ++ and C # languages. First program Since we use a browser, the program must be stored as an HTML file. Open the notepad and create the file as shown in the first screenshot. As you can see, the text is an HTML file, the program code of interest to us is located inside the angle brackets with the name “script”. Save the file as 01.html. The first program is ready! It is enough to open the “Explorer”, find the created file and launch it by double-clicking. A browser will open in which the results of the program will be displayed, namely the text Hello world (see the second screenshot). Variable declarations Obviously, a program must do something, for example, process and display various data. To store them, we can declare variables inside our program. Consider the example in screenshot No. 3. It is unlikely that this code needs comments. We created the variable R, assigning it a value of 10, and calculated the circumference using the well-known formula. Note the use of the “+” operator in output, which allows you to combine lines into one.

Loops A program, like the one written above, runs linearly, from operator to operator. However, it is often necessary to repeat a code fragment a certain number of times, for this there is a for loop. For an example, we will display a table of squares and cubes of numbers from 1 to 10. The code and the results of its execution are shown in screenshots Nos. 4 and 5. The inner part of the code, separated by curly brackets, will be executed the required number of times, determined by the condition of the cycle. The result of the work is shown in screenshot No. 6. The BR tag is used in HTML for line feeds, which allows you to split the table into lines. Conditions It is often necessary for code to execute under certain conditions. For example, consider the simplest “magic square” – this is a 3 × 3 square, the sum of numbers in which is the same across all lines and diagonals. We derive such squares using a computer, for this we need cycles and the condition for comparing equality. As in the previous case, the code and the results of execution can be seen in the screenshots. In Javascript, as in C or C ++, the == operator is used to calculate equality, the additional condition that the sum is greater than 12 is also checked (since there are 9 in the diagonal of the square and at least 2 more, the sum cannot be less than this value). To run this program, the computer will have to “think” for a few minutes, because to search for all the options you need to sort out 999999999 values, which is ensured by nine nested cycles. However, it is on such tasks that the main advantages of a computer over the human brain are manifested – the ability to quickly process information. Although it should be noted that the found “square” (in the screenshot No. 7 circled in red) was known in China under the name “Luo Shu” even before our era, so that ancient people were not born too … You can also note the use of the variable count to count found squares, as soon as the square is found, we increase the value of the variable by one.

What is Rear Admiral Grace Hopper famous for?
Grace Hopper was an excellent mathematician and one of the first "encoders", so-called programmers. In the mid-twentieth century, she, as an officer of the US Navy, like everyone who was…

...

Will computers kill chess as a sport?
The question would seem to be simple, but finding the answer to it is not so simple. Let's try to figure it out together. For centuries, chess has been a…

...

HP All-in-One 24-f0030ur All-in-One PC
The HP All-in-One 24-f0030ur is a high-speed home-use machine with a dual-core processor of the 8th generation and a storage system based on hard drive and solid-state drive. Such a…

...

Cleaning personal computer components
Cleaning personal computer components On numerous forums with surprising constancy there are branches in which the interlocutors try to understand the causes of failures in laptops and personal computers. As…

...