A collection of ordered instructions written to allow a computer to perform certain operations or solve a problem
Algorithm: Specific methods and steps to solve the problem
Flowchart is a graphical representation of the algorithm.
Flow chart is intuitive, clear, more conducive to people to design and understand the algorithm.
It uses a predefined set of symbols to illustrate how to perform specific tasks
History of computer language
1.
Machine Language
1) Introduction: All code inside only 0 and 1, each instruction is called "Machine instruction"
2) Advantages
U code can be directly recognized by the computer , directly to the hardware , program execution efficiency is very high
You can directly access and control the computer's various hardware devices , such as disk , memory ,CPU, I/O ports , etc.
3) Disadvantages
The U program is full of 0 and 1 instruction codes with poor readability and error-prone
U is very dependent on hardware , so the machine language of different models of computer is not the same . that is to say, if 2 different models of machines want to achieve the same function , you need to write 2 sets of completely different code
You have to memorize all the instructions and instructions of the computer you are using , and the instructions are more difficult to remember.
4) Use the occasion
In summary, machine language is difficult to master and promote , now in addition to computer manufacturers of professionals , the vast majority of programmers have no longer to learn machine language
2.
Assembly Language
1) Introduction: Replace machine instructions with English words and other symbols
2) Advantages
U like machine language, you can directly access , control the computer's various hardware devices
You use less memory and perform faster
3) Disadvantages
U different machines have different assembly language syntax and compilers , code lacks portability , that is, a program can only run on one machine , you can't run it on another machine.
The U symbol is very many , difficult to remember , even if the completion of simple functions also requires a lot of assembly language code , It is easy to produce a BUG, difficult to debug
U must know the hardware very well , the development efficiency is very low , the cycle is long and monotonous
4) Use the occasion
U operating system kernel, driver, microcontroller program
Encryption, decryption and decoding of U software
Manufacture and prevention of U virus
debugging and Analysis of U program
3.
Advanced Language
1) Introduction: Close to natural language
2) Advantages
U simple, easy to use, easy to understand, syntax and structure similar to general English
U away from the direct operation of the hardware, so that the average person after learning can be programmed, without being too familiar with the hardware knowledge
U a program can also be run on different machines, with portability
3) Disadvantages
U program can not be directly recognized by the computer, it needs to be translated into binary instructions by the compiler to run to the computer
4) types:c ,C+ +,C #,Java,objective-c Wait
4.
comparison of three different languages
respectively, using machine language, assembly language, C Language (high-level language) to write a program to calculate the
1) Machine language: It is a heavenly book!!!
10111000 00000001
00000000 00000101
00000001 00000000
2) Assembly language: Readability a little better, but trouble
MOV ax,1
ADD ax,1
3) C language: Streamlined, easy to understand
Up
Introduction to C language
The C language was designed by Bell Labs ' Dennis Ritchie in 1973. C was originally used to develop system-level programs.
On the microcomputer, there are many good-performing commodity C language systems available. Includes Turbo C, Borland
C language Features:
Structured programming Language: Clear hierarchy, easy to organize programs in a modular way, easy to debug and maintain
Simple statement: It is relatively easy to get started in learning, and C language summarizes the library concepts presented in other languages.
Powerful: It can be used for the development of system software, and also for the development of application software.
Good transplant: As long as the language slightly modified, you can adapt to different models of machines or various types of operating systems.
Basic structure of C language
#include <stdio.h>//the . h suffix file is called a header file, which can be a standard library file that is readily available in a C program or a custom library file.
void Main () {//program starts from main function;
printf ("helloworld\n"); printf print output;
}
Code Execution process
1. Source code (with. c as the file name extension, which is a user-created file)
2. target file (usually with. O or. obj as the file name extension, which is the compiler-compiled file)
3. executable file (end with. exe as suffix is the input result of the connector)
4. Running
#include <stdio.h>
int main ()
{
\ n: line break \ t: tab Stop
/*
printf ("************\n");
printf ("*\n");
printf ("*\n");
printf ("*\n");
printf ("*\n");
printf ("************\n");
*/
printf (" name \ t language \ t math \ T English \ n");
printf (" Zhang San \t80\t90\t70\n");
return 0;
}
#include <stdio.h> void Main () { /* printf ("*******************************\n");/\ n: line break printf (" Zhengzhou four grade table \ n"); printf ("*******************************\n");/\ n: line break printf (" name language English math \ n"); printf (" Zhang San 80\n"); printf (" John Doe 80\n"); */ printf ("*******************************\n");/\ n: line break printf ("T- Zhengzhou four-grade table \ n"); printf ("*******************************\n");/\ n: line break printf (" name \ T language \ t English \ t math \ n"); //\ t: tab-Stops (tab) equivalent to several spaces printf (" Zhang San \t80\t80\t80\n"); printf (" John Doe \t80\t80\t80\n"); } |
From the development of computer language to my first line of code (HELLOWORLD)