Nama : Ersus Saeful Hidayat
NIM : 49012050
JURUSAN : TMD (Teknik Media Digital) - STEI - ITB
JURUSAN : TMD (Teknik Media Digital) - STEI - ITB
Link Video Semua Tipe Data klik disini
Tipe Data Dasar yang telah didefinisikan dalam tipe bilangan bulat
(integer), bilangan real (floating point), tipe logika (boolean), dan tipe
karakter/teks (character/string).
Link Video Tipe Data Dasar klik disini
Source code :
/* =================================================
Program Tipe Data Dasar Microsoft Visual C++ 2012
Modul 2_1
Nama : Ersus
Saeful Hidayat
NIM : 49012050
Jurusan: TMD (Teknik Media Digital)
================================================ */
#include <iostream>
using namespace std;
int main()
{
cout <<
"=====================================
\n";
cout <<
" BELAJAR TIPE
DATA \n";
cout <<
"=====================================\n\n";
int X;
X = 10;
cout <<
"Contoh Nilai
Tipe Bilangan Bulat X = ";
cout <<
X << endl << endl;
double Y;
Y = 123.134;
cout <<
"Contoh Nilai
Tipe Bilangan Riil Y = ";
cout <<
Y << endl << endl;
char Karakter = 'A';
char* Teks = "Kata";
char TEKS[39] = "Teks dengan batas sebanyak 39 karakter";
cout <<
Karakter << endl;
cout <<
Teks << endl;
cout <<
TEKS << endl << endl;
system ("pause");
return (0);
}
Konversi Tipe Data, jika dalam suatu ekspresi terdapat operand dengan tipe
yang berbeda, maka C++ akan mengkonversi salah satu tipe tersebut sehingga
kedua tipe menjadi sama. Jadi operasi perhitungan dalam C++ dapat dilakukan
hanya dengan menggunakan tipe data yang sama.
Link Video Konversi Tipe Data klik disini
Source code :
/* =================================================
Program Konversi Tipe Data Microsoft Visual C++ 2012
Modul 2_2
Nama : Ersus
Saeful Hidayat
NIM : 49012050
JURUSAN: TMD (Teknik Media Digital)
================================================ */
#include <iostream>
using namespace std;
int main()
{
char Karakter = 'A';
cout <<
"Konversi Tipe
Data \n";
cout <<
"\nKarakter
A = ";
cout <<
Karakter;
cout <<
endl;
cout <<
"\nNilai ASCII
= ";
cout <<
(int) Karakter;
cout <<
endl;
system ("pause");
return 0;
}
Konstanta merupakan jenis identifier yang bersifat konstan atau tetap,
artinya nilai konstanta adalah tidak dapat diubah. Konstanta berguna untuk
menentukan nilai yang merupakan tetapan, misalnya nilai phi(), satuan dari
kecepatan cahaya dan sebagainya.
Link Video Konstanta klik disini
Source code :
/* =================================================
Program Konstanta Microsoft Visual C++ 2012
Modul 2_3
Nama : Ersus
Saeful Hidayat
NIM : 49012050
JURUSAN: TMD (Teknik Media Digital)
================================================ */
#include <iostream>
using namespace std;
const int MAX = 5;
int main()
{
int A[MAX];
for (int C = 0; C < MAX; C++)
{
A[C] =
C * 10;
}
for (int c = 0; c < MAX; c++)
{
cout
<< A [c] << endl;
}
system("pause");
return 0;
}
Variabel adalah sebuah identifier yang nilainya dapat diubah sesuai dengan
kebutuhan program.
Link Video Variabel klik disini
Source code :
/* =================================================
Program Variabel Global & Lokal Microsoft Visual C++
2012
Modul 2_4
Nama : Ersus
Saeful Hidayat / azzahrazahrayaya2007
NIM :
49012050
JURUSAN : TMD (Teknik Media Digital)
================================================ */
#include <iostream>
using namespace std;
int A;
int main()
{
A = 100;
cout <<
" Nilai
variabel A = ";
cout <<
A;
cout <<
endl;
cout <<
endl;
int B;
B = 50;
cout <<
" Nilai
Variabel B = ";
cout <<
B;
cout <<
endl;
cout
<<endl;
system ("pause");
return 0;
}
Link Video Tipe Data Limit klik disini
Source code :
/* =================================================
Program Latihan Tipe Data Limit Microsoft Visual C++ 2012
Modul 2_5
Nama : Ersus
Saeful Hidayat
NIM : 49012050
JURUSAN: TMD (Teknik Media Digital)
================================================ */
#include <iostream>
#include <limits>
using namespace std;
int main()
{
cout <<
" Praktikum
Pemrograman Visual C++ 2012 \n\n";
cout <<
" Dikerjakan
Oleh : Ersus Saeful Hidayat \n";
cout <<
" NIM :
49012050 \n";
cout <<
" JURUSAN : TMD
(Teknik Media Digital) \n\n";
cout <<
"
==================================== \n";
cout <<
" TIPE DATA
\n";
cout <<
"
==================================== \n";
cout <<
" minimum char = " << CHAR_MIN << endl;
cout <<
" maximum char = " << CHAR_MAX << endl;
cout <<
" minimum
signed char = " << SCHAR_MIN << endl;
cout <<
" maximum
signed char = " << SCHAR_MAX << endl;
cout <<
" maximum
unsigned char = " << UCHAR_MAX << endl;
cout <<
" minimum short = " << SHRT_MIN << endl;
cout <<
" maximum short = " << SHRT_MAX << endl;
cout <<
" minimum int = " << INT_MIN << endl;
cout <<
" maximum int = " << INT_MAX << endl;
cout <<
" minimum long = " << LONG_MIN << endl;
cout <<
" maximum long = " << LONG_MAX << endl;
cout <<
" maximum
unsigned short = " << USHRT_MAX << endl;
cout <<
" maximum
unsigned = " << UINT_MAX << endl;
cout <<
" maximum
unsigned long = " << ULONG_MAX << endl;
cout <<
"
==================================== \n";
system ("pause");
return 0;
}
No comments:
Post a Comment