Home >Common Problem >What is a program? What are the basic elements of the program?
A program is a set of instructions that a computer can recognize and execute. It runs on an electronic computer and is an information tool that meets certain needs of people. A program can instruct the computer to perform the actions we want it to do. The basic elements included in a program are: constants, variables, expressions, statements and functions.
What is the program? Basic elements included in a program
A program is a set of operable work steps designed to achieve a specific goal. For a computer, a program is a set of ordered instructions that the system can recognize. . Programs instruct the computer to perform actions we want it to do. The program is stored on the disk. During execution, it goes from the disk to the memory and then to the register, and is finally executed by the CPU. The execution process of the program is somewhat similar to the process of handling government affairs by the ancient emperor, and can be compared. In ancient times, the public sentiment outside the palace and the memorials written by the ministers were like programs. The outside world was like a hard drive. The program was stored in the hard disk. The ministers were like the memory. The ministers summarized the public sentiments and handed them over to the eunuchs. The eunuchs were the registers. The eunuchs would The memorial was handed over to the emperor for processing, and the CPU also retrieved the program from the register and then executed it. A program is a language used to communicate with the computer. It consists of specific syntax and keywords. Starting from the entry point, the program is executed from top to bottom, from left to right, line by line.
The basic components of a computer program include (constants) (variables) (expressions) (statements) and (functions), etc.
What are the programming languages?
When computers were first born, programs were pieces of binary language called machine language. Because binary language programming is really inconvenient and not suitable for writing and reading, assembly language gradually emerged. Assembly language replaces some key instructions in machine language with some symbols. Compared with machine language, assembly language is indeed It has some readability, but assembly is still very complicated and the programming workload is still very large. So high-level languages came into being. High-level languages are getting farther and farther away from machines. On the contrary, their grammar is close to human natural language. Moreover, high-level languages no longer execute instructions, but statements. One line of statements corresponds to multiple instructions. Therefore, it The development efficiency is getting higher and higher. However, high-level languages must be compiled into machine code. High-level languages have good portability.
There are several basic concepts about programs. Compiled language refers to a language that needs to be compiled and linked to produce an executable file, such as Java/c/c. Interpreted languages refer to languages that do not require compilation and linking processes and can be executed directly in a specific program or environment, such as JavaScript/python, etc. Data is the object of computer program processing, which can be integers, real numbers, characters, or encoded representations of images, sounds, etc. Data structure refers to the existence of one or more specific relationships between data. Closely related to data structure is the type of data and the storage of data. Programming is the process of programming. Software is composed of programs and documents.
The above is the detailed content of What is a program? What are the basic elements of the program?. For more information, please follow other related articles on the PHP Chinese website!