Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer...

21
UNIT 2: INTRODUCTION TO THE CHIDE BY: DANIEL BRENES

Transcript of Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer...

Page 1: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

UNIT 2: INTRODUCTION TO THE CHIDE

BY: DANIEL BRENES

Page 2: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 3: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 4: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

HOW TO NAME FILE

IN THE CHIDE

FIRST, CLICK SAVE AS

Page 5: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

HOW TO NAME FILE IN THE

CHIDE

• Then, click the H drive

Page 6: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 7: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

HOW TO NAME FILE IN THE

CHIDE

Make sure not forget the

.ch at the end

Page 8: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 9: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 10: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

WHAT IS A MULTI-LINE COMMENT

• A multi-line comment

starts with /*

• Ends with */

Page 11: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

WHAT IS A PRINTF STATEMENT

• A printF statement is used to

print letters and numbers on

the screen

Page 12: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 13: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 14: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

HOW TO PRINT INTEGERSAND DOUBLES

• To print integers on the screen you must use

%d

• This stands for integer

Page 15: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 16: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 17: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 18: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 19: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

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

Page 20: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

MUTLI SCANF

• two variables can be put on

the scanF

Page 21: Unit 2: introduction to the chide•Input/Output: refers to the communication between a computer program and a Input/Output devices •String: letters,number,and symbol •Conversion

USING SCANF TO SOLVE PROBLEMSHERE IS AN EXAMPLE