► Main page, Previous page

Programming primer

OUTPUT

Topic: How we find out what data are in computer?

7 and 8 period

Repetition: Drawing

red.jpg

Means: Put as many grains you want in the red drawer.

New teaching material:

Question: What does mean the drawing you see below? (Attention! The direction of the arrow is changed.)

output_slika1.jpg

This instruction will not represent the request “Empty the red drawer” as somebody could assume. This drawing means: “Check how many grains are there in the reed drawer and write this number in your notebook or on the blackboard, The grains remain in the drawer.”

The name of such an instruction is OUTPUT. After OUTPUT data remains in Mema, but its contents is copied somewhere outside of Mema, for instance in the notebook.

A riddle: What you can give away and not lose? Answer: Friendship (Now we can see that data behave is the same way.)

Assignment: Put in every drawer of your Mema a number of grains (as many you want). Write in your notebook how many grains are there in the next drawers:

output_slika2.jpg

This is an assignment with many correct answers, because every child fill in his or hers Mema with an arbitrary number of grains. But in the moment when he or she write the numbers, the numbers must be the same as the numbers in drawers given by instructions.

  • To check the correct answers the teacher has to check the Memas and the notebooks of every child. The contents in drawers given by instructions will be compared with numbers in the notebook.
  • If the numbers in notebook are 4,5,3 and 2 then the contents of red drawer must be 4 in blue 4, in green 3 and in yellow 2.

Assignment: Write (draw) a program which put in every drawer of your Mema a number of grains (as many you want), and then ask you to write in your notebook how many grains are there in red, blue, yellow, black and green drawer.

Comment: Students instructions use only colors without text as is our drawings.

Solution:

output_slika3.jpg

Some additional questions the teacher can ask for better understanding:

  • How many grain are there in the gray drawer? (Answer: The students count the grains in the gray drawer and answer.)
  • Why this number is not in your notebook? (Answer: Because there was not an OUTPUT for the gray drawer or because it was not requested or similar.)
  • How many OUTPUT instruction are in program? (Answer: 4.)
  • What would happen if two drawer of a Mema were of red color? (This would be confusing, If we had an INPUT or OUTPUT addressing red drawer we could not know which one (or both) to fill in or copy on output.)
  • Why are the drawers of different colors? (Answer: Just to be different.)

Assignment: Draw the instruction which will empty the red drawer.

Tip: First all have to perceive that this can not be done by OUTPUT instruction.!!!!!

Repetition: What does this instruction do??

output_slika1.jpg

Answer: Wit this instruction a request is given to write out the contents of red drawer without changing its contents.

red.jpgThe red drawer may be emptied by putting in it 0 grains (none).

PROCESSING

Clicking the link PROCESSING you can go to the next lesson.

en/izlaz.txt · Last modified: 2016/03/01 09:10 by sbabic
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0