Professional Documents
Culture Documents
a x caked = ด เ นการ
@ x cutable
-Source for Re
object file
comment
=>
commenting
ำ
ยื
ำ
นิ
escape Sequence : sequence of
by
(base -
- decimal
10 decimal numbers/ +เ า
point
1.742E5 20.8: floating point number
=1.742x185
3.
Octal number
base - 8 intergars) 074 0115 02
-start with o
20
-start with Ox
5 , characters
- letters of
symbols p' ' ' In'
-must be in single photos
6.
string S
"Eves"
is
duble
↳ก
-must be in
quotes 9394
of pecifier
1. 1. d- denary numbers
char- character S
to use a
variable, we must declare it frist.
9. don't
keyword Bat เ ยน ให ไ
ว
Assignmentstate ment
- use to assign value to variable
1= x becomes P' VC,
3; -
X= 5; not an equation.
light speed = 300000000
Anithmetic calculation
addition a -
bic; Add a to band store
subtraction a bee;
theysee
thefrom the and
stone the difference in a
-
C; by and
a = a
* 3/ 3 = 73)/ 3 = -1
5) ( 3) = - /3) :
Modulo operation
divienda divisor * quotient a
remaindet
Ex 5/. 3 -> 3 = 3*+ remainder - > SY. 3 = 2
-= subtraction - 1) - a- = b; -> a = a-
bi
* = multiplication
/ -- ak= b; <-> d=
adb;
/= division - 11 - a/b; ==> a=
alb
~> = modulo operati on - 19 - 0% = b ; <- > a= b;
a/
↑ take
&
Rule > of
operations a wo
1. Left to
right for binary
Operators operand
2. Right to let for t
·parand
One
Avoid combining single arithmetic operators I
compound anithmetic operations, and increment
and dectement operations.
x: attab /
↳
Getthe
1= G*
bXtra; Depending on
compliens
Use parenthesis (
· ช
-
Relational
#a
operators
== is
equal to a = b that if a is equal to b
/ heb TRUE
9 = is not equal to a if a is not qual to b
a
Logical expression แ วจ าง
&4/ 1 * P-P P= P
(
<
use
①not parentheses
pot P
ตั
ม่
ค่
of
Order
operations ( revisted
* * - & Lunary operators)
&
* , "
Use parenthese
< <= > > =
to avoid confusion
= =
:
& &
"
ssignment
Input/ Output functions
prints int
of
-> address
the
add
prompt message
Short cat evaluation
is jus
ex . (itsof a litt
Civic of 11 littl
result
je2, i=
S
Conditional statements
②If statements
1. Yif condition
free
of
the
amenities
i
fake
2.
if ( conditions
monfiltra
3
#
3. If I condition
↓ true
(entire
>integr go to number
& -
false,
( )
add
fansell number
If
rules
grammar -missing &
variables
Emissing; - undeclared 4. Logic entors =
programs
-whong variable names follow fanity algorithms
- unbalanced parentheses Whony placement
Ex.- of braces
Type of
tasting
1. Black - box testing - without looking at the code
Debugging Advantage
buy (a) error a computer program.
of thechatting case will less likeli
conrelate
debug (v) find and remove
bugs with the code
Test
flow to debag a
program disadvantages 1.
may not cover all
1.
Input test cases thatgive known possibilities
out puts 2. Glass box
testiny - with looking at the code
2. Add diagnostic calls to print
f
the programs
disadvantages so fast cases will more likely
correlate with the code
Internative statement
1. While state mont # ดะไ ตะใค
ข
While ↓อ
condition ()
/ ↓ &
' stor :
to menti
:
ก าเ ยนค ง ไ อน
pations
3 white
<
false
for
t
3. state men
3.1
for ( state monte,
--
condition, statement); -
false
·
sum: samt
i
#I to
can use program
floor
5
ตลองาน
ผิ
ดี
ก่
ำ
ขี
ำ
ำ
ม่
ว้
ว่
สั่
รั
ปั
ผิ
1. break terminates the loop * 8 = false
olse = true
#
3.2 for ( stement -condition,
:
statement - int
!emanticf/
-
itunes
2. continue things the program control false }
to the beginning of theloop. In the
if forces the next
other words,
itenation of the loop
num/e = 1 : 2
Array s
How to declare
type name sizes's
EX
float value SJ; -
-value - This is
array
one dimensional
continuous
2P type name now) dumms;
Id. JIdal... hut ;
-
type name
Array intralization
type, namesize = values, values, ... , value- size:
type nowcolumns = values, values, ... ,value.column as, value- columntzc
name
/ "ว 4
name of namen-1j
ที่
ตั
On
my body on
Searching and sorting an auto
seauching
INPUT : an array a
of numbers and a number
OUTPUT: If the number is found
·print
the indices of the cell where the number
every element
sequentially and check in it.
ทะ เบ
0 1 2 3 4 5 6 -> 8 9
16 5- 2011 14 15 1 -
·9
Search for 15
Search for 10
search for - B
Notfound
souting : 0 1 2 3 4
5 6 7 · 9
-- ช
6- 5 9 - - G 13 01 4
↓
a min
all the numbers are arranged in order -8 . . . - 8
minpos
Selection Sout = repeatedly finding the
88** ** $... xg
of
minimum ( image ascending order) element
from the unsouted part and putting it tomp
at the
beginning . .
short , * write name **, write clean t
* don'tput comme on
space in out put
No electric