Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lab 1:c++


Published on

Introduction to Programming Language

Published in: Education
  • Be the first to comment

  • Be the first to like this

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