Input/Output Design - Physical design of output reports and input forms.
Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer...
Transcript of Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer...
UNIT 2: INTRODUCTION TO THE CHIDE
BY: DANIEL BRENES
MODULE 5 KEY TERMS
• Source code: plain text which contains instruction of a program
• Comments: used to document a program and to make it more reliable
• File extension: a group of letters occurring after a period in a file name, indicating the
format of the file
• Function: The basic executable module in a program
• Calling: asking the function to do something
• Editing pane: on the top I for writing and editing a program source file or any text file
• Input/ Output Pane: located below the editing pane and is initially hidden
MODULE 5 TABLE OF CONTENT
• How to name and save a file on the ChIDE
• How to perform a multi-line comment and a single line comment
• How to perform a printF statement
• How to end every line of code in the ChIDE
HOW TO NAME FILE
IN THE CHIDE
FIRST, CLICK SAVE AS
HOW TO NAME FILE IN THE
CHIDE
• Then, click the H drive
HOW TO NAME FILE IN THE CHIDE
• Name the program what
the assignment is.
• Camel case is a good style
to use when naming EX:
helloWorld.ch
HOW TO NAME FILE IN THE
CHIDE
Make sure not forget the
.ch at the end
HOW TO COMMENT
ON THE PROGRAM
• There are two ways to comment a multi-line
comment or a single line
• Comments are always green
• If the letters are black they are not included in
your comment
WHAT IS A SINGLE LINE
COMMENT
• A single line comment
starts with //
• Don’t worry about closing
it because it only runs on
that single line
WHAT IS A MULTI-LINE COMMENT
• A multi-line comment
starts with /*
• Ends with */
WHAT IS A PRINTF STATEMENT
• A printF statement is used to
print letters and numbers on
the screen
HOW TO END THE LINE OF CODE
• After writing the line of code end it with a
semicolon
• If not ended with semicolon you will receive
an error
• This yellow bar means there is a problem
with the program
HOW TO USE \N
• The symbols used are \n this command is
used to have the exit code
• Not really need but if you want style point
and to be more organized
HOW TO PRINT INTEGERSAND DOUBLES
• To print integers on the screen you must use
%d
• This stands for integer
HOW TO PRINT DOUBLES OR DECIMAL
• To decimals on the screen use
%lf
• %lf stands for double
• If you don’t want many zeros
you can add .2 when you add
%.2lf
HOW TO USE PRINTF TO SOLVE PROBLEMS
• Declare whether it is a int or double
• In this case gameCost, warranty, totalCost
would be a double
• Then initialize how much it cost
• Add them then use a printF to show the total
cost
HOW USE A DOUBLE AS A PERCENT
• To put any percent in a program you must
make it a decimal Ex: %11.2 turns into .112
MODULE 6 KEY TERMS
• Input/Output: refers to the communication between a computer program
and a Input/Output devices
• String: letters,number,and symbol
• Conversion specifiers: the format of strings
• Sales tax: the tax on the sale of an item or service
WHAT IS A SCANF
• A scanF if used to get input
from the users
• for the scanF never forget to
add the & in front of the
variable
MUTLI SCANF
• two variables can be put on
the scanF
USING SCANF TO SOLVE PROBLEMSHERE IS AN EXAMPLE