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

 

Sample Program:

This program reads a customer balance and the amount of a check.

If the check can be paid, a new balance is computed and the value to be paid is output;

If the check cannot be paid, a value of zero is printed.

High Level Program

Assembly Program

Machine Language

cin>>balance;
cin>>check;
if(balance>=check)
{
balance=balance-check;
cout<<check;
}
else
{
cout<<0;
}
read balance;
read check;load balance;
sub check;
bneg dont;
stor balance;
write check;
stop;
dont: write zero;
stop;
balance:
check:
zero: 0

0

7

31

2

7

30

4

1

31

6

4

30

8

5

16

10

2

31

12

8

30

14

9

0

16

8

29

18

20

28

30

0