Programming Language A programming language is a translator - - PowerPoint PPT Presentation

programming language
SMART_READER_LITE
LIVE PREVIEW

Programming Language A programming language is a translator - - PowerPoint PPT Presentation

Programming Language A programming language is a translator between human and machine. Machine language is a set of codes each consists of a binary string usually of length multiple of 8 (00000101,1000000,..) Since it is


slide-1
SLIDE 1

Programming Language

  • A programming language is a translator between human and

machine.

  • Machine language is a set of codes each consists of a binary

string usually of length multiple of 8 (00000101,1000000,..)

  • Since it is difficult to use binary codes we design programming

languages.

  • Each program language has a compiler which creates a

machine codes.

slide-2
SLIDE 2

But Why use a programming Language?

  • We can built powerful programs/algorithms, to make the

computer do something we want to.

Programming Language

But Wait, what’s an Algorithm, and how it can make the computer do something?

slide-3
SLIDE 3

Algorithm

Definition:

  • A process or set of rules to be followed in calculations or
  • ther problem-solving operations, especially by a
  • computer. - Wikipedia
  • A process with unambiguous steps that has a beginning

and an end, and does something useful. - Wikipedia

  • A list of steps that you may follow in order to achieve a

goal - My definition

slide-4
SLIDE 4

Algorithm - Daily Examples

  • Faster Grocery

Steps 1. Make a list of grocery shopping 2. Sort your grocery list by location in the store 3. Go to your favorite market 4. Get the grocery cart 5. Trace the best/faster route, based on your sorted list 6. Shop and Have fun

slide-5
SLIDE 5

Algorithm - Daily Examples

slide-6
SLIDE 6

Algorithm

But how to apply for a computer ?

  • Basically, it’s the same idea. You decide the steps, write it down, and

ask the computer to execute the algorithm.

  • But how can I write an algorithm and ask the computer to execute it ?
  • As said it before, computers understand only 0 and 1(Machine

language)

  • We must use a translator, in order to “talk” to the computer
slide-7
SLIDE 7
slide-8
SLIDE 8

How to write this example, in English?

  • 1. If need glasses:

2. Get some glasses

  • 3. Then:
  • collect ingredients and equipment
  • Turn on your oven
  • Prepare cake tins
  • Prepare cream
  • Put in the oven
  • 4. while cake is not done(loop)
  • keep it in the oven
  • 5. Remove it from oven
  • 6. Enjoy your Cake
slide-9
SLIDE 9

Time to practice

slide-10
SLIDE 10

How to Translate the Algorithm

  • We are going to use C programing language