Lab 1:c++

687 views
555 views

Published on

Introduction to Programming Language

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
687
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Lab 1:c++

  1. 1. Introduction to Programming Language
  2. 2. What’s the program?• It contains a list of ingredients (called variables) and a list of directions (called statements) that tell the computer what to do with the variables. The variables can represent numeric data, text, or graphical images.
  3. 3. What’s the programming language?• A programming language is a translator between human and computer.• It translates the human languages into machine code so that a computer can understand and run it.
  4. 4. Steps of writing a program1. Read the problem.2. Write an algorithm (Pseudocode) to solve the problem.3. Draw a flow chart for the program.4. Choose a programming language.5. Convert the algorithm into the programming language.
  5. 5. Example 1• Write an algorithm to calculate the area of the square.
  6. 6. Pseudocode1. Input the length.2. area = length*length.3. Print area
  7. 7. Flow chart Symbols Terminator Start / Stop Data I/O ProcessNo Decision Yes Flow line Connector
  8. 8. Flow chart Start1. Input the length. Input L2. area = length*length.3. Print area Area = L*L Print Area Stop
  9. 9. Example 2• Write an algorithm to print the maximum number between three numbers (a, b, c).
  10. 10. Pseudocode1. Read a, b, c.2. if a>b if a>c print a else print c else if b>c print b else print c

×