CMPS 002 - Computer Literacy

Prof. Paulo Franca

CyberSlug Rules!

Classes

Class Syllabus

Grading Policy

Labs

Interact

Login

  • enter system
  • get attendance
  • submit work
  • take lab quiz
  • check scores

Help

Help me!

Links

Staff only

 

 

 

Datacare   Ahshay

 

Consider the example program in machine language:

 

Compute the average of three scores entered by the user and display the result.

Machine language vs Assembly Language

Machine Language   Assembly Language
09 99
09 98
09 97
01 99
03 97
03 96
06 95
02 94
10 94
99  
   
 
IN 99
IN 98
IN 97
LOAD 99
ADD 97
ADD 96
DIV 95
STO 94
OUT 94
STOP  
95 3

FORTRAN:

FLOAT MID1,MID2,FINAL
FLOAT AVERAGE
READ(2,100) MID1,MID2,FINAL
AVERAGE=(MID1+MID2+FINAL)/3
WRITE(3,110) AVERAGE
END

The compiler will figure out memory locations for the variables MID1,MID2, FINAL and AVERAGE

Then translate to machine language generating an executable (or object) program

Javascript

There is no compilation, program is translated during execution.