Presentation is loading. Please wait.

Presentation is loading. Please wait.

Input and Output Output Prompt: –A message displayed to the user indicating what they are to enter. Should be clear and exact on what you want. write:

Similar presentations


Presentation on theme: "Input and Output Output Prompt: –A message displayed to the user indicating what they are to enter. Should be clear and exact on what you want. write:"— Presentation transcript:

1

2 Input and Output

3 Output Prompt: –A message displayed to the user indicating what they are to enter. Should be clear and exact on what you want. write: –used for output, no return writeln: –has a return for next line to be printed on CRT.

4 Input readln –u–used to get the information from the user into a variable. –Y–YOU MUST PUT THE VARIABLE NAME!!! readln(name); –C–Can be used without a variable to hold the output on the screen. readln;

5 Formatting Output In a writeln you can combine literals and variables by seperating them by commas. –writeln(‘Hi ’, name, ’, it is nice to meet you!’);

6 More on Formatting You can increase the number of spaces that a variable uses. –writeln(‘Name’:10, ‘Date’:10); – Name Date For real numbers you can also state the number of places after the decimal. –writeln(‘Ave=‘, ave:5:1); –Ave= 95.6

7 Assignment Statement := is read “becomes equal to”. variable := expression. –ave := (num1+num2)/2; operators follow math order of operations –(+ = plus), (- = minus), (* = multiply), –(/= division), (div=quotient of integer division), –(mod=remainder of integer division)

8 Assignment Questions for chapter 4 are due Friday. Lab test on Friday 1/2 period #6 on page 110. Written Test on Friday ch 3 and 4 Program due next Friday –Do the 5 steps for the following assignment. –Number 4 on page 111. Be sure to be colorful and creative with your output. –Ask the user their name and include a title on the report. Like Luci’s Calorie Counter.


Download ppt "Input and Output Output Prompt: –A message displayed to the user indicating what they are to enter. Should be clear and exact on what you want. write:"

Similar presentations


Ads by Google