- vừa được xem lúc

Programming

0 0 38

Người đăng: Chuột bàn phím

Theo Viblo Asia

  1. Definition of Programming

Programming is the process of creating a set of instructions that tell a computer how to perform a task; or we can also understand Programming is the implementation of logic to facilitate specific computing operations and functionality.

  1. Definition of an Algorithm
  • An algorithm is an effective, efficient and best method which can be used to express solution of any problem within a finite amount of space and timeand in a well-defined formal language.

  • All Algorithms must satisfy the following criteria:

Input: more quantities that are extremely supplied. Output: At least one quantity is produced. Definiteness: Each instruction should be clear and unambiguous. Finiteness: The process should be terminated after a finite number of steps. Effecitveness: Every instruction must be basic enough to be carried out theoretically. 3. Building a Program

3.1. Indentifying problem

Identifying what it is you know (input), and what it is you want to obtain (output) -> produce a written agreement that, among specifies the kind of input, processing, and output required.

3.2. Planning solution

Draw a flowchart or to write pseudocode.

Flowchart is a pictorial representation of a step-by-step solution to a problem, consists of arrows representing the direction the program takes and boxes and other symbols representing actions. It is a map of what your program is going to do and how it is going to do it. Pseudo code permits to focus on the program logic without having to be concerned just yet about the precise syntax of a particular programming language. 3.3. Building algorithm

Build step by step procedure for solving problem.

3.4. Implementing program

Express solution in a programming language; translate the logic from the flowchart or pseudocode-or some other tool-to a programming language.

3.5. Testing and correcting program

Test program on the computer, involves these phases:

Desk-checking: Check the logic of the program to attempt to ensure that it is error-free and workable. Translating: Checks the syntax of program to make sure the programming language was used correctly, giving coder all the syntax-error messages and translates program into a form the computer can understand. Debugging: means detecting, locating, and correcting bugs (mistakes), usually by running the program. In this phase coder runs the program using test data that he devises. 3.6. Documenting program

Documentation is a written detailed description of the programming cycle and specific facts about the program. Typical program documentation materials include the origin and nature of the problem, a brief narrative description of the program, logic tools such as flowcharts and pseudocode, data-record descriptions, program listings, comments and testing results.

  1. Building an Algorithm

4.1. Natural language

Natural languages are sometimes referred to as knowledge-based languages, because natural languages are used to interact with a base of knowledge on some subject. The use of a natural language to access a knowledge base is called a knowledge-based system.

Example: "If this number is 1, print case 1 on display. If this number is 2, print case 2 on display".

4.2. Flow diagram

A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task.

Example:

image.png

4.3. Pseudo code

Pseudocode is an artificial and informal language that helps programmers develop algorithms. Pseudocode is a "text-based" detail (algorithmic) design tool. The rules of Pseudocode are reasonably straightforward.

Example:

START

READ INPUT into x

IF x is 1 THEN

PRINT "I am case 1”

IF x is 2 THEN

PRINT "I am case 2"

RETURN 0

4.4. Language programming

A programming language is a computer language that is used by programmers (developers) to communicate with computers. It is a set of instructions written in any specific language (C, C++, Java, Python) to perform a specific task.

Example:

int main()

{

int x; scanf ("%d", &x); if (x == 1) { printf (“I am case 1”); } if (x == 2) { printf (“I am case 2”); } return 0;

}

Bình luận

Bài viết tương tự

- vừa được xem lúc

Memory layout của một chương trình C/C++

1. Đặt Vấn Đề.

0 0 45

- vừa được xem lúc

Sự khác nhau giữa bộ nhớ Heap và bộ nhớ Stack trong lập trình

1. Giới thiệu. . Như chúng ta đã biết thì việc Quản lý bộ nhớ đối với một lập trình viên là rất quan trọng.

0 0 57

- vừa được xem lúc

Tích hợp thư viện C/C++ vào một dự án Flutter như thế nào?

Chào các bạn hôm nay rảnh rỗi thì mình viết một bài hướng dẫn về cách tích hợp một thư viện C/C++ vào một dự án Flutter. Thì cũng khá đơn giãn thôi vì Flutter đã cũng cấp cho chúng ta một thư viện khá

0 0 62

- vừa được xem lúc

Gọi hàm của C++ trong Python bằng ctypes

Nếu đã từng dùng qua các thư viện liên quan đến toán học của Python như numpy, các bạn sẽ để ý thấy các nó có tốc độ xử lý rất nhanh. Điều này là do một phần của package này được viết bằng C/C++ và ph

0 0 42

- vừa được xem lúc

Build ứng dụng Cross Platform với Go và CGO

1. Giới thiệu.

0 0 37

- vừa được xem lúc

Về gcc và g++

Về gcc và g++. Nếu thử man gcc và man g++ trên terminal, bạn đều thấy đều trỏ về 1 page với tiêu đề:. . gcc - GNU project C and C++ compiler.

0 0 29