Oct
21
2015
0

Algoritma dan Pemrograman Part 3

Algoritma Pertemuan 3

Selection definition
Syntax:
-if
-if-else
-switch-case

If
Syntax sangat penting karena jika error di syntax dan benerinnya lama itu buang guang waktu.
If mengandung True atau False

If-else
Memiliki 2 pilihan. Jika memiliki 3 pilihan maka akan masuk ke if, elseif, dan else.

Nested-if
Memiliki seleksi di dalam seleksi, seperti ATM sistemnya

Switch-case
-Expression nya tidak berupa True dan False. Bisa karakter.
-Lebih kepada jika kita mencari suatu angka. Contohnya seperti pilihan menu, seperti menghitung huruf vokal dan konsonan.
-Apa yang ada di if, bisa di switch-case, tapi apa yang ada di switch-case, gabisa di if.

Ternary operator
-Biasanya hanya bisa program turunan C.

Go to and Labe bukan struktural sehingga tidak diwajibkan lagi

Jenis error ada 4:
-compile-time
-link-time –> jarang terjadi.
-run-time
-logical –>paling ngeselin

Written by parisaputra in: Uncategorized |
Oct
14
2015
0

Algoritma dan Pemrograman part 2

Operator : + – / * =

Operand : A B C D dst

 

Unary = 1 operand
Binary = 2 operands
Ternary = 3 operands

Jenis Operator :
– Assisgment operator = berisikan value (=)
– Integer = berisikan bilangan bulat
– Logical Operator = berisikan True dan False
– Arithmatic Operator =berisikan operasi aritmatika
– Relational Operator = berisikan perbandingan(== != < > <= >=)
– Bitwise Operator = berisikan 1 dan 0 sebagai titik acuan
– Pointer Operator = berisikan operator untuk menuju kesuatu “address” atau value

 

Combined Operators

x = y++ –> Nilai y yang sudah di tambah baru dimasukkan ke variabel x

z= ++y –> Nilai y dimasukkan ke z lalu y melakukan penjumlahan

a += b –> a = a + b

a -= b –> a = a – b

a *= b –> a = a * b

dsb

 

Conditional Expression

syntax : exp1 ? exp2 : exp 3;

contoh: z = (a>b) ? a : b;

 

xor (^)

A   B   ^
T   T   F
T   F   T
F   T   T
F   F   F

rumus poligami (penjelasan panjangnya)
misal ada a dan b

a | b & !(A&B)
contoh:

a | b & !(A&B)
T&!(T)
T&F
F

 

bahasa computer : 1 = true, 0 = false

bit 10 = 1010

penjelasan lain:
BIT 15 = 1 1 1 1, cari hasil perpangkatan 2 yang mendekati atau sama dengan 15
2^3 = 8, masukkan 1 dipaling depan -> 1 _ _ _
15-8=7, cari hasil perpangkatan 2 yang mendekati atau sama dengan 7
2^2=4, masukkan 1 di kedua dari depan -> 1 1 _ _
7-4=3, cari hasil perpangkatan 2 yang mendekati atau sama dengan 3
2^1=2, masukkan 1 di ketiga dari depan -> 1 1 1 _
3-2=1, cari hasil perpangkatan 2 yang mendekati atau sama dengan 1
2^0, masukkan 1 di terakhir -> 1 1 1 1

 

bitwise:
>> –> dibagi
<< –> dikali

Written by parisaputra in: Uncategorized |
Oct
01
2015
0

What I’ve Learned Today (October 1st, 2015)

Guest Lecturer: Feri

 

oop = object oriented programming

Machine language use 1 and 0, it’s called assembly

C language is a moderate level of language

 

Encapsulation: private/public

Inherited: sunah

Abstract: wajib/sunah or we may called pansy (banci)

Interface: wajib

Polymorphism: ?

 

Blue Print is like a sketch

 

twitter.com use NoSQL (monggodibi) as its database and it use java language, or ruby, etc.

 

History of Algorithm:

Founder -> Al-Khwarizmi

 

Definition of Algorithm:

-Set a Sequential Instructions developed to describe important processes in producing an Output with specific required Input is given.

 

Flow Chart:

Untitled

 

Flow Chart Definition:

-Shows logic of an algorithm

-Emphasizes individual steps and their interconnections

-e.g. control flow from one action to the next.

 

Sequence:
-Sequence is series of consecutive commands/statements

 

Pseudo Code:

Definition of Pseudo Code:

-An artificial and informal language that helps you develop algorithms

-Pseudo Code is similar to human language, convenient, and user friendly.

Basic Computer Operation an Pseudo Code:

1) Input

2) Output

3) Compute

4) Storing Value to an Identifier (Store)

5) Compare

6) Repetition (Loop)

 

History of C
Founder: Martin Richard

 

Why Using C:

-Flexibility

-Portability

-A Well Known Programming Language

-Supported With a Large Number of Libraries

 

C Structure :

1)

main ()

{

statements;

}

2)

main ()

{

statements;

return (0);

}

3)

void main ()

{

statements;

}

4)

int main ()

{

statements;

return (0);

}

 

Escape Sequences:

> \a     = bell, alert, system beep

> \b     = back space

> \t      = horizontal tab

> \n     = new line, line feed

> \v     = vertical tab

> \r      = carriage return

> \’       = single quote

> \”      = double quote

> \\      = backslash

> \xdd = hexadecimal notation

> \ddd = octal notation

 

Data Type:

>In C, there are 5 data types and 4 modifiers.

Data Types:

-Character                       = char

-Integer                            = int

-Floating Point               = float

-Double Floating Point = double

-Void                                 = void

Modifiers:

-signed

-unsigned

-long

-short

UntitleWd

 

Keywords:

-Keywords/reserved words are words that have special meaning to the C compiler

Example:

-auto                 -double           -int                -struct

-break               -else                -long             -switch

-case                  -enum             -register       -typedef

-char                  -extern           -return          -union

-const                -float               -short            -unsigned

-continue          -for                  -signed         -void

-default             -goto                -sizeof           -volatile

-do                     -if                     -static            -while

Written by parisaputra in: Uncategorized |

Powered by WordPress. Theme: TheBuckmaker. Zinsen, Streaming Audio