2. POKOK PEMBELJARAN
TUJUAN DAN PENCAPAIAN
• Menjelaskan berbagai macam tipe data,
variable, konstanta, operator, dan ekspresi
serta sintaks penulisannya.
• Penerapan tipe data, variable, konstanta,
operator, dan ekspresi dalam sebuah
program.
• Membuat program aplikasi yang
menerapkan tipe data, variable/konstanta,
operator, dan ekspresi
MATERI POKOK
• Tipe data
• Variable
• Konstanta
• Operator
• Ekspresi
www.slidescarnival.com/help-use-presentation-template
2
3. A. tipedata dan systax penulisannya
Tipe data adalah klasifikasi data yang mengenalkan kompilator atau
penerjemah bahasa pemrograman bagaimana program bermaksud untuk
menggunakan data. Atau proses memperkenalkan jenis data kepada kompiler,
agar kompiler tahu maksud dari program yang dibuat. Jenis nilai yang akan
tersimpan dalam variable.
Pada dasarnya tipe data dalam bahasa pemrograman C++ terbagi
menjadi 3 bagian;
1.Tipe data angka, untuk angka dan berhubungan dengan aritmetika.
2.Tipe data karakter, untuk karakter dan angka (bukan untuk operasi
aritmetika)
3.Tipe data logika, untuk logika benar (True) atau salah (False).
3
4. Jenis tipe data dalam bahasa pemrograman c++
Beberap jenis tipe data yang sering digunakan dalam bahasa pemrograman C
++;
4
TIPE DATA SYMBOL
DEKLARASI
KETERANGAN
Interger int Bilangan Bulat
Float Point float Bilangan Desimal
Double Floating Point double Bilangan Desimal dengan jangkauan lebih luas
Karakter char Karakter
Boolean bool Logika True dan False
String string Karakter jangkauan lebih luas/kalimat
8. variable
Variable adalah suatu tempat yang berfungsi untuk menyimpan nilai atau konstanta.
Konstanta adalah tetapan dari suatu nilai yang bersifat tetap. Nilai akan ditetapkan saat
sebelum kompilasi program, data tersebut tidak akan bisa diubah sepanjang kode
sumber program dan di saat program tersebut sedang berjalan (runtime)
8
Nilai tersebut biasanya di dapat dari masukan pengguna, programmer, lingkungan,
atau merupakan hasil dari proses program.
Variabel yang telah kita buat merupakan sebuah memori pada komputer. Di dalam
komputer, tepatnya pada memori komputer, sebenarnya terdapat banyak sekali
memori yang tersusun yang memiliki alamat sebagai penanda memori
9. Syarat-syarat mendeklarasikan sebuah variable
1.Tidak boleh ada spasi ( contoh : gaji bersih ) dan dapat menggunakan tanda garis bawah ( _ )
sebagai penghubung (contoh : gaji_bersih).
2.Tidak boleh diawali oleh angka dan menggunakan operator aritmatika.
3.Tidak boleh dimulai dengan karakter non huruf
4.Tidak boleh menggunakan karakter-karakter ~ ! @ # $ % ^ & * ( ) + ` - = { } [ ] : " ; ' < > ? ,
5.Tidak boleh menggunakan reserved words yang ada dalam C/C++
Variable dibagi menjadi 2 kelompok;
a. Variable Numerik
Variable numerik dibagi menjadi 3 bagian, yaitu;
Bilangan bulat atau integer
Bilangan desimal berpresisi tunggal atau Floating Point
Bilangan desimal berpresisi ganda atau Double Floating Point
b. Variable Text
Character (Karakter Tunggal)
String (untuk rangkaian karakter)
9
10. Deklarasi variable dan assigment
Deklarasi variable adalah suatu bentuk untuk memperkenalkan variable ke program dan
menentukan tipe data.
Assigment adalah proses pemberian nilai kepada suatu variabel yang telah dideklarasikan. Berikut
adalah contoh assignment.
Bentuk penulisan
Tipe_data;
Tipe_data variable;
Tipe_data variable=assignment;
10
11. 1. Integer adalah salah satu tipe
data numerik yang
memungkinakn kita untuk
menyimpan data dalam bentuk
bilangan bulat.
Tipe data dan variable serta bentuk penulisannya
Bentuk penulisan
Tipe_data nama_variable =
assigment;
int a=10;
11
12. 2. Floating Point (float) adalah salah satu
tipe data Numerik yang memungkinkan
untuk menyimpan nilai dalam memori
bersifat bilangan pecahan atau real,
maupun eksponensial.
Tipe data dan variable serta bentuk penulisannya
Bentuk penulisan
Tipe_data nama_variable =
assigment;
float pecahan=10.5555f;
12
13. 3. Double Floating Point (double) adalah
salah satu tipe data yang bersifat
menyatakan bilangan pecahan atau real,
maupun eksponensial. Bedanya adalah
penyimpanan angka maksimal lebih
besar daripada float, otomatis double
juga akan membutuhkan memori yang
lebih besar.
Tipe data dan variable serta bentuk penulisannya
Bentuk penulisan
Tipe_data nama_variable =
assigment;
double pecahan= 10.55555;
13
14. 3. Character (char) adalah salah satu tipe
data sembarang huruf, angka, dan
simbol. Yang memungkinkan kita untuk
memesan memori yang dapat
menyimpan nilai dalam bentuk karakter
tunggal seperti ‘a’, ‘$’, ‘1’ dan lain-lain.
4. Character (string) mrupakan tipe data
Text yang memungkinkan kita
menyimpan nilai dengan bentuk text,
kumpulan dari karakter.
Tipe data dan variable serta bentuk penulisannya
Bentuk penulisan
Tipe_data nama_variable =
assigment;
char nama= ‘A’;
//menampung 1 karakter
char namaku [4]=“Ar”
14
15. 5. Boolean (bool) salah satu tipe data yang
dapat memiliki nilai dari dua pilihan
yaitu True (1) atau False (0) . Tipe data
ini biasanya digunakan untuk
memberikan dan memastikan
kebenaran dari sebuah operasi atau
kondisi program.
Tipe data dan variable serta bentuk penulisannya
Bentuk penulisan
Tipe_data nama_variable =
assigment;
bool benar=true;
bool salah=false;
bool data1=1>0;
bool data2=2<0;
bool data3=‘A’ == ‘a’;
bool data4= ‘1’ != ‘2’;
15
16. konstanta
Konstanta adalah sebuah tempat atau container dari suatu nilai. Sesuai
dengan namanya, nilai dari konstanta bersifat tetap (konstan) dan
tidak bisa diubah sepanjang program berjalan. Inilah yang menjadi
pembeda antara konstanta dengan variabel.
Konstanta mirip dengan variable, namun memiliki nilai tetap.
Konstanta dapat berupa nilai Integer, Float, Karakter dan String.
16
17. Cara deklarasi konstanta
Deklarasi konstanta dapat dilakukan dengan 2 cara, yaitu;
1. Menggunakan keyword (#define)
Deklarasi konstanta dengan cara ini, lebih gampang dilakukan karena menyertakan #define sebagai
prepocessor directive. Dan sintaknya diletakkan bersama-sama dengan pernyataan #include . Jadi bila ingin
membuat konstanta dengan keyword #define, konstanta ini ditulis sebelum main().
Pendeklarasian dengan #define tanpa diperlukan adanya tanda = untuk memasukkan nilai ke dalam
pengenal dan juga tanpa diakhiri dengan tanda semicolon(;).
Format penulisannya :
#define nama_konstanta
#define nama_konstanta nilai konstanta
#define phi 3.14159265
#define Newline ‘n’
#define lebar 100
pendeklarasian dengan #define tanpa diperlukan adanya
tanda = untuk memasukkan nilai ke dalam pengenal dan juga
tanpa diakhiri dengan tanda semicolon(;).
17
18. Cara deklarasi konstanta
Deklarasi konstanta dapat dilakukan dengan 2 cara, yaitu;
1. Menggunakan keyword (const)
Pendeklarasian konstanta menggunakan perintah const mirip dengan deklarasi variable yang ditambah kata
depan const. Yang artinya baris sintaks berada dalam main () fungsi dan juga harus disertakan tipe data dari
konstanta tersebut.
Bentuk penulisan :
const tipe_data variable=nilai;
Contoh :
const int lebar=100;
const char kar=‘T’;
const int zip =1212;
18
19. A picture is worth a thousand words
A complex idea can be conveyed with just a single still image,
namely making it possible to absorb large amounts of data quickly.
19
28. Yellow
Is the color of gold, butter
and ripe lemons. In the
spectrum of visible light,
yellow is found between
green and orange.
Blue
Is the colour of the clear sky
and the deep sea. It is
located between violet and
green on the optical
spectrum.
Red
Is the color of blood, and
because of this it has
historically been associated
with sacrifice, danger and
courage.
Yellow
Is the color of gold, butter
and ripe lemons. In the
spectrum of visible light,
yellow is found between
green and orange.
Blue
Is the colour of the clear sky
and the deep sea. It is
located between violet and
green on the optical
spectrum.
Red
Is the color of blood, and
because of this it has
historically been associated
with sacrifice, danger and
courage.
Let’s review some concepts
28
29. You can insert graphs from Excel or Google Sheets
29
4000
3000
2000
1000
0
30. Mobile project
Show and explain your web, app or software projects using these gadget templates.
30
31. Tablet project
Show and explain your web, app or software projects using these gadget templates.
31
32. Desktop project
Show and explain your web, app or software projects using these gadget templates.
32
34. Credits
Special thanks to all the people who made and
released these awesome resources for free:
✖ Presentation template by SlidesCarnival
✖ Photographs by Unsplash
34
35. Presentation design
This presentations uses the following typographies and colors:
✖ Titles: Amatic SC
✖ Body copy: Merriweather
You can download the fonts on these pages:
https://www.fontsquirrel.com/fonts/amatic
https://www.fontsquirrel.com/fonts/merriweather
✖ Light gray #f5f6f7
✖ Dark gray #95a5a6
✖ Navy #2c3e50
✖ Salmon #f55d4b
You don’t need to keep this slide in your presentation. It’s only here to serve you as a design guide if you
need to create new slides or download the fonts to edit the presentation in PowerPoint®
35
37. Timeline
37
DEC
NOV
OCT
SEP
AUG
JUL
JUN
MAY
APR
MAR
FEB
JAN
Blue is the colour of
the clear sky and the
deep sea
Red is the colour of
danger and courage
Black is the color of
ebony and of outer
space
Yellow is the color
of gold, butter and
ripe lemons
White is the color of
milk and fresh snow
Blue is the colour of
the clear sky and the
deep sea
Yellow is the color
of gold, butter and
ripe lemons
White is the color of
milk and fresh snow
Blue is the colour of
the clear sky and the
deep sea
Red is the colour of
danger and courage
Black is the color of
ebony and of outer
space
Yellow is the
color of gold,
butter and ripe
lemons
38. Roadmap
38
1 3 5
6
4
2
Blue is the colour of
the clear sky and the
deep sea
Red is the colour of
danger and courage
Black is the color of
ebony and of outer
space
Yellow is the color of
gold, butter and ripe
lemons
White is the color of
milk and fresh snow
Blue is the colour of
the clear sky and the
deep sea
40. SWOT Analysis
40
STRENGTHS
Blue is the colour of
the clear sky and the
deep sea
WEAKNESSES
Yellow is the color of
gold, butter and ripe
lemons
Black is the color of
ebony and of outer
space
OPPORTUNITIES
White is the color of
milk and fresh snow
THREATS
41. Business Model Canvas 41
Key Activities
Insert your content
Key Resources
Insert your content
Value Propositions
Insert your content
Customer
Relationships
Insert your content
Channels
Insert your content
Customer Segments
Insert your content
Key Partners
Insert your content
Cost Structure
Insert your content
Revenue Streams
Insert your content
43. Team Presentation
43
Imani Jackson
JOB TITLE
Blue is the colour of the
clear sky and the deep sea
Marcos Galán
JOB TITLE
Blue is the colour of the
clear sky and the deep sea
Ixchel Valdía
JOB TITLE
Blue is the colour of the
clear sky and the deep sea
Nils Årud
JOB TITLE
Blue is the colour of the
clear sky and the deep sea
46. SlidesCarnival icons are
editable shapes.
This means that you can:
● Resize them
without losing
quality.
● Change fill color
and opacity.
Isn’t that nice? :)
46
48. You can also use any emoji as an icon!
And of course it resizes without losing quality.
How? Follow Google instructions
https://twitter.com/googledocs/status/730087240156643328
✋👆👉👍👤👦👧👨👩👪💃🏃💑❤
😂😉😋😒😭👶😸🐟🍒🍔💣📌📖🔨
🎃🎈🎨🏈🏰🌏🔌🔑 and many more...
48
49. Free templates for all your presentation needs
Ready to use,
professional and
customizable
100% free for personal
or commercial use
Blow your audience
away with attractive
visuals
For PowerPoint and
Google Slides
49