SlideShare a Scribd company logo
TUGAS PRAKTIKUKM MICROSOFT VISUAL STUDIO PEMROGRAMAN C++
DENDI RIADI : TEKNIK KOMPUTER KARYAWAN SEMESTER 4
/* =========================================================
Program Pertama microsoft visual studio 2010
Modul 1
Nama : Dendi Riadi
=========================================================*/
#include <iostream> //preprosesor
int main() // fungsi main
{
std::cout << "Ini adalah pertama sayan";
std::cout << "Dengan menggunakan Microsoft Visual Studio C++.n";
return 0;
}
// modul 2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "ini program kedua saya n";
std::cout << "Menggunakan visual C++." << std::endl;
return 0;
}
//modul 1-3
#include <iostream>
using namespace std;
int main()
{
char tampilkan[1];
char panjang_data[50];
cout << "================================================ n";
cout << " BELAJAR PEMROGRAMAN C++ n";
cout << "================================================ n";
cout << " NAMA : ";
cin.getline (panjang_data,50);
cout << " JURUSAN : Teknik Komputer POLITEKNIK PAJAJARAN " <<endl;
cin.getline(tampilkan,1);
return (0);
}
/* Modul 1.4
Belajar Syntax error
======================================= */
#include <iostream>
using namespace std;
int main()
{
cout << "+++++++++++++++++++++++++++++++++++++++++++ n";
cout << " Memepelajari Syntax errorr n";
cout << "+++++++++++++++++++++++++++++++++++++++++++ n";
cout << " Syntax error adalah kesalahan n";
cout << " Jangan lupa untuk melakukan perintah n";
cout << " Clean Solution yang berada pada n";
cout << " menu Build, sebelum mengkompilasi n";
cout << " program Microsoft Visual Studio C++ n";
return (0);
}
// modul 1-5
// limit.cpp
#include <iostream>
#include <limits>
using namespace std;
int main()
{
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;
return (0);
}
// Modul 2-1
// Tipe data dasar.cpp
#include <iostream>
using namespace std;
int main()
{
cout << "============================================== n";
cout << " BELAJAR TIPE DATA n";
cout << "============================================== n";
int X;
X = 10;
cout << "Contoh Nilai Tipe Bilangan Bulat X = "
<< X << endl << endl;
double Y;
Y =123.123;
cout << "Contoh Nilai Tipe Bilangan Riil Y = "
<< 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;
return (0);
}
//Modul 2-2
//Konversi type data
#include <iostream>
using namespace std;
int main()
{
char Karakter = 'D';
cout << "Karakter D = "
<< Karakter
<< endl;
cout << "Nilai ASCII = "
<< (int) Karakter
<< endl;
return (0);
}
// Modul 2-3
// Konstanta
#include <iostream>
using namespace std;
const int MAX = 10;
int main()
{
int A[MAX];
for (int C = 0; C < MAX; C++)
{
A[C] = C * 7;
}
for (int c = 0; c < MAX; c++)
{
cout << A [c] << endl;
}
return (0);
}
// modul 2-4
// variabel global & lokal
#include <iostream>
using namespace std;
int A;
int main()
{
A = 10;
cout << " Nilai variabel A = "
<< A
<< endl
<< endl;
int B;
B = 300;
cout << " Nilai Variabel B = "
<< B
<< endl
<< endl;
return (0);
}
//Modul 3-1
//Operator Assignment
#include <iostream>
using namespace std;
int main()
{
int a,b;
a = 20;
b = 100;
a = b;
b = 7;
cout << "a = ";
cout << a;
cout << endl;
cout << "b = ";
cout << b;
cout << endl;
return (0);
}
// modul 3-2
// operator unary
#include <iostream>
using namespace std;
int main()
{
int e,g;
double f,h;
e = +8;
f = -3.14;
cout << "Nilai e : " << e << endl;
cout << "Nilai f : " << f << endl;
g = -e;
h = -f;
cout << "Nilai g : " << g << endl;
cout << "Nilai h : " << h << endl;
return (0);
}
// modul 3-3
// increment
#include <iostream>
using namespace std;
int main()
{
int i,j;
i = 5;
cout << "Nilai i awal : " << i << endl;
cout << "Nilai ++i : " << ++i << endl;
cout << "Nilai i akhir : " << i << endl;
cout << 'n';
j = 10;
cout << "Nilai j awal : " << j << endl;
cout << "Nilai ++j : " << ++j << endl;
cout << "Nilai j akhir : " << j << endl;
cout << 'n';
return (0);
}
// modul 3-4
// decrement
#include <iostream>
using namespace std;
int main()
{
int k;
float l;
k = 100;
l = 10.5;
cout << "Nilai k awal : " << k << endl;
cout << "Nilai --k : " << --k << endl;
cout << "Nilai k akhir : " << k << endl;
cout << 'n';
cout << "Nilai l awal : " << l << endl;
cout << "Nilai l-- : " << l-- << endl;
cout << "Nilai l akhir : " << l << endl;
return (0);
}
//modul 4-1
//operator aritmatika
#include <iostream>
using namespace std;
int main()
{
cout << "2 + 3 = "
<< 2 + 3
<< endl << endl;
cout << "10 - 5 = "
<< 10 - 5
<< endl << endl;
cout << "4 x 3 = "
<< 4 * 3
<< endl << endl;
cout << "4 / 2 = "
<< 4 / 2
<< endl << endl;
cout << "10 % 3 = "
<< 10 % 3
<< endl << endl;
return (0);
}
// modul 4-2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << " OPERASI OPERATOR LOGIKA n";
cout << "n Tabel Kebenaran operator AND n";
cout << " 1 && 1 = " << (1 && 1) << endl;
cout << " 1 && 0 = " << (1 && 0) << endl;
cout << " 0 && 1 = " << (0 && 1) << endl;
cout << " 0 && 0 = " << (0 && 0) << endl;
cout << "n Tabel Kebenaran operator OR n";
cout << " 1 || 1 = " << (1 || 1) << endl;
cout << " 1 || 0 = " << (1 || 0) << endl;
cout << " 0 || 1 = " << (0 || 1) << endl;
cout << " 0 || 0 = " << (0 || 0) << endl;
cout << "n Tabel Kebenaran operator NOT n";
cout << " !1 = " << !1 << endl;
cout << " !0 = " << !0 << endl << "n";
return (0);
}
// Modul 4-3
// Operator Bitwise
#include <iostream>
using namespace std;
int main()
{
int U, V, W;
U = 1 << 1;
V = 1 << 2;
W = 1 << 3;
cout << "1 << 1 = " << U << endl;
cout << "1 << 2 = " << V << endl;
cout << "2 << 3 = " << W << endl << endl;
int X, Y, Z;
X = 16 >> 1;
Y = 16 >> 2;
Z = 16 >> 3;
cout << "16 >> 1 = " << X << endl;
cout << "16 >> 2 = " << Y << endl;
cout << "16 >> 3 = " << Z << endl << endl;
int A = 1;
int B = 0;
cout << "A = " << A << endl;
cout << "B = " << B << endl;
cout << "!A = " << !A << endl;
cout << "!B = " << !B << endl;
cout << "A & B = " << (A & B) << endl;
cout << "A | B = " << (A | B) << endl;
cout << "A ^ B = " << (A ^ B) << endl << endl;
return 0;
}
// modul 4-4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int X;
cout << "Masukkan Nilai X = ";
cin >> X;
cout << 'n';
X = (X < 0) ? -X : X;
cout << "|X| = " << X;
cout << "n n";
return 0;
}
//project 5-1 : Pencabangan IF
// Nama : Dendi
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "Kelulusan Siswa n n";
double Nilai_Ujian;
cout << "Masukkan Nilai Ujian : ";
cin >> Nilai_Ujian;
cout << endl;
char Hasil_Ujian[12] = "Tidak Lulus";
if (Nilai_Ujian >= 60)
strcpy (Hasil_Ujian, "Lulus");
cout << "Hasil Ujian : "
<< Hasil_Ujian
<< endl << endl;
return (0);
}
// Project 5-2 : Pencabangan Dua Kondisi (IF_ELSE)
// Nama : Dendi Riadi
#include <iostream>
using namespace std;
int main()
{
cout << "KELULUSAN SISWA n n ";
double Nilai_Ujian;
cout << "Msukkan Nilai Ujian : ";
cin >> Nilai_Ujian;
cout << endl;
if (Nilai_Ujian >= 60)
{
cout << ("Hasil Ujian = LULUS")
<< endl << endl;
}
else
{
cout << "Hasil Ujian = TIDAK LULUS"
<< endl << endl;
}
return (0);
}
//modul 5-3 : pencabangan IF bersarang
// Nama : Dendi Riadi
#include <iostream>
using namespace std;
int main()
{
double Nilai_Ujian;
char Indeks;
cout << " KONVERSI NILAI SISWA n n";
cout << " Masukkan Nilai Ujian : ";
cin >> Nilai_Ujian;
cout << endl;
if (Nilai_Ujian >= 85){
Indeks = 'A';}
else
if (Nilai_Ujian >= 75){
Indeks = 'B';}
else
if (Nilai_Ujian >= 55){
Indeks = 'C';}
else
if (Nilai_Ujian >= 40){
Indeks = 'D';}
else
{
Indeks = 'E';}
cout << "Indeks Siswa = " << Indeks << endl;
return (0);
}
// Project 5-4 : Pernyataan Switch
// Nama : Dendi Riadi
#include <iostream>
using namespace std;
int main ()
{
int pilihan;
cout << "Staff pengajar pemrograman C++ :" << endl;
cout << "================================" << endl;
cout << "1. Dr. Ary Setijadi Prihatmanto" << endl;
cout << "2. Dr. Aciek Ida Wuryandarin";
cout << "3. Dr. Pranoto Rusmin";
cout << "n4. Hendrayana, MT" << endl;
cout << "5. Marisa Paryasto, MT" << endl;
cout << "6. Kusprasapta Mutijarsa, MT" << endl;
cout << "7. Syahban Rangkuti, MT" << endl;
cout << "8. Reza Darmakusuma, MT" << endl;
cout << "9. Ferlin Ashadi, MTn";
cout << "10.Amiratusyadiah, MT" << endl << endl;
cout << "Staff pengajar Pemrograman C++ : ";
cin >> pilihan;
cout << endl;
switch (pilihan)
{
case 1:
cout << "Pilihan anda salahn" << endl;
break;
case 2:
cout << "Pilihan anda benarn" << endl;
break;
case 3:
cout << "Pilihan anda salahn" << endl;
break;
case 4:
cout << "Pilihan anda salahn" << endl;
break;
case 5:
cout << "Pilihan anda benarn" << endl;
break;
case 6:
cout << "Pilihan anda salahn" << endl;
break;
case 7:
cout << "Pilihan anda benarn" << endl;
break;
case 8:
cout << "Pilihan anda benarn" << endl;
break;
case 9:
cout << "Pilihan anda salahn" << endl;
break;
case 10:
cout << "Pilihan anda benarn" << endl;
break;
default:
cout << "Pilihan anda tidak ada dalam daftarnn";
}
return (0);
}
// Modul 6-1
// Nama : Dendi Riadi
#include <iostream>
using namespace std;
int main()
{
int pencacah = 1;
do
{
cout << " D4 - Teknologi Media Digital n" ;
pencacah++ ;
}
while (pencacah <= 10);
return (0);
}
// modul 6-2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int pencacah = 1;
do
{
cout << " TEKNIK KOMPUTER & MULTIMEDIA n" << endl;
cout << " POLITEKNIK PAJAJARAN n" << endl << endl;
pencacah++ ;
}
while (pencacah <=6);
return 0;
}
// modul 6-3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cout << "PENGULANGAN MENAIK" << endl;
for (int C=0; C<10; C++){
cout << C+1 << endl;
}
cout << 'n';
cout << "PENGULANGAN MENURUN " << endl;
for (int D=10; D>0; D--){
cout << D << endl;
}
return 0;
}
// modul 6-4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
for (int j=1; j<=10; j++){
for (int k=1; k<=j; k++){
cout << k*j << ' ';
}
cout << 'n';
}
return 0;
}

More Related Content

PDF
Impact of the New ORM on Your Modules
PPTX
Category theory, Monads, and Duality in the world of (BIG) Data
PDF
C++ L11-Polymorphism
PPTX
KEY
Sbaw091006
PDF
A swift introduction to Swift
PDF
C++ Programs
PPTX
Lexical environment in ecma 262 5
Impact of the New ORM on Your Modules
Category theory, Monads, and Duality in the world of (BIG) Data
C++ L11-Polymorphism
Sbaw091006
A swift introduction to Swift
C++ Programs
Lexical environment in ecma 262 5

What's hot (20)

PDF
ECMAScript 6
ODP
EcmaScript 6
PPTX
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
PPTX
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
PPTX
Rx.NET, from the inside out - Codemotion 2018
PDF
How to Clone Flappy Bird in Swift
DOC
Program for hamming code using c
PDF
Ruby closures, how are they possible?
PPT
Developing iOS apps with Swift
PDF
Алексей Кутумов, Coroutines everywhere
KEY
連邦の白いヤツ 「Objective-C」
PDF
Explaining ES6: JavaScript History and What is to Come
PDF
Letswift19-clean-architecture
DOC
Useful c programs
PDF
An Intro To ES6
PDF
Architecture for Massively Parallel HDL Simulations
PDF
FalsyValues. Dmitry Soshnikov - ECMAScript 6
PDF
How to Create a l10n Payroll Structure
PDF
Introducción a Elixir
DOCX
Web lab programs
ECMAScript 6
EcmaScript 6
QA Fest 2019. Saar Rachamim. Developing Tools, While Testing
(Rx).NET' way of async programming (.NET summit 2017 Belarus)
Rx.NET, from the inside out - Codemotion 2018
How to Clone Flappy Bird in Swift
Program for hamming code using c
Ruby closures, how are they possible?
Developing iOS apps with Swift
Алексей Кутумов, Coroutines everywhere
連邦の白いヤツ 「Objective-C」
Explaining ES6: JavaScript History and What is to Come
Letswift19-clean-architecture
Useful c programs
An Intro To ES6
Architecture for Massively Parallel HDL Simulations
FalsyValues. Dmitry Soshnikov - ECMAScript 6
How to Create a l10n Payroll Structure
Introducción a Elixir
Web lab programs
Ad

Viewers also liked (17)

PDF
Bracket Busting: Predicting the College Basketball Tournament with Social Media
PDF
Foxpro
PPTX
Bahasa Pemrograman C++
PPTX
Web design and_html
PPTX
Proyek 3 proyek web html menggunakan notepad
PDF
Pemrograman web dengan php my sql
PDF
Webdesign Gestaltungsgrundlagen für Nicht-Designer, Normales und Entwickler
PPTX
Web designp pt
PPTX
Proyek web html menggunakan notepad
PPSX
Formularios En Visual Fox Pro
PDF
Tutorial Microsoft Visual FoxPro 9.0
PDF
Analisis dan perancangan sistem informasi
PPTX
Visual foxpro
PPT
Web design
PDF
Modul web design - studi kasus website portal berita
PPT
Html Ppt
PDF
Tutorial Microsoft Visual FoxPro 9.0
Bracket Busting: Predicting the College Basketball Tournament with Social Media
Foxpro
Bahasa Pemrograman C++
Web design and_html
Proyek 3 proyek web html menggunakan notepad
Pemrograman web dengan php my sql
Webdesign Gestaltungsgrundlagen für Nicht-Designer, Normales und Entwickler
Web designp pt
Proyek web html menggunakan notepad
Formularios En Visual Fox Pro
Tutorial Microsoft Visual FoxPro 9.0
Analisis dan perancangan sistem informasi
Visual foxpro
Web design
Modul web design - studi kasus website portal berita
Html Ppt
Tutorial Microsoft Visual FoxPro 9.0
Ad

Similar to Tugas praktikukm pemrograman c++ (20)

PPT
ch5_additional.ppt
PPTX
Project in programming
PDF
C++ practical
PDF
Object Oriented Programming (OOP) using C++ - Lecture 5
DOCX
Laporan pd kelompok 6
PDF
C++ TUTORIAL 3
DOCX
Assignement of programming & problem solving
PDF
C++ L05-Functions
PDF
Object Oriented Programming (OOP) using C++ - Lecture 2
PPTX
Oops presentation
PDF
Pointers
PDF
C++ TUTORIAL 2
DOCX
Include
DOCX
Algoritma 5 november wiwik p.l
PPTX
Lec 2.pptx programing errors \basic of programing
DOCX
Oop lab report
PDF
3 rd animation
PDF
Contoh program c++ kalkulator
ch5_additional.ppt
Project in programming
C++ practical
Object Oriented Programming (OOP) using C++ - Lecture 5
Laporan pd kelompok 6
C++ TUTORIAL 3
Assignement of programming & problem solving
C++ L05-Functions
Object Oriented Programming (OOP) using C++ - Lecture 2
Oops presentation
Pointers
C++ TUTORIAL 2
Include
Algoritma 5 november wiwik p.l
Lec 2.pptx programing errors \basic of programing
Oop lab report
3 rd animation
Contoh program c++ kalkulator

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation theory and applications.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Group 1 Presentation -Planning and Decision Making .pptx
1. Introduction to Computer Programming.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Dropbox Q2 2025 Financial Results & Investor Presentation
20250228 LYD VKU AI Blended-Learning.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Getting Started with Data Integration: FME Form 101
Mobile App Security Testing_ A Comprehensive Guide.pdf
Network Security Unit 5.pdf for BCA BBA.
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation theory and applications.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology

Tugas praktikukm pemrograman c++

  • 1. TUGAS PRAKTIKUKM MICROSOFT VISUAL STUDIO PEMROGRAMAN C++ DENDI RIADI : TEKNIK KOMPUTER KARYAWAN SEMESTER 4 /* ========================================================= Program Pertama microsoft visual studio 2010 Modul 1 Nama : Dendi Riadi =========================================================*/ #include <iostream> //preprosesor int main() // fungsi main { std::cout << "Ini adalah pertama sayan"; std::cout << "Dengan menggunakan Microsoft Visual Studio C++.n"; return 0; } // modul 2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> int _tmain(int argc, _TCHAR* argv[]) { std::cout << "ini program kedua saya n"; std::cout << "Menggunakan visual C++." << std::endl; return 0; } //modul 1-3 #include <iostream> using namespace std; int main() { char tampilkan[1]; char panjang_data[50]; cout << "================================================ n"; cout << " BELAJAR PEMROGRAMAN C++ n"; cout << "================================================ n"; cout << " NAMA : "; cin.getline (panjang_data,50); cout << " JURUSAN : Teknik Komputer POLITEKNIK PAJAJARAN " <<endl; cin.getline(tampilkan,1); return (0); } /* Modul 1.4 Belajar Syntax error ======================================= */ #include <iostream> using namespace std; int main()
  • 2. { cout << "+++++++++++++++++++++++++++++++++++++++++++ n"; cout << " Memepelajari Syntax errorr n"; cout << "+++++++++++++++++++++++++++++++++++++++++++ n"; cout << " Syntax error adalah kesalahan n"; cout << " Jangan lupa untuk melakukan perintah n"; cout << " Clean Solution yang berada pada n"; cout << " menu Build, sebelum mengkompilasi n"; cout << " program Microsoft Visual Studio C++ n"; return (0); } // modul 1-5 // limit.cpp #include <iostream> #include <limits> using namespace std; int main() { 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; return (0); } // Modul 2-1 // Tipe data dasar.cpp #include <iostream> using namespace std; int main() { cout << "============================================== n"; cout << " BELAJAR TIPE DATA n"; cout << "============================================== n"; int X; X = 10; cout << "Contoh Nilai Tipe Bilangan Bulat X = " << X << endl << endl; double Y; Y =123.123; cout << "Contoh Nilai Tipe Bilangan Riil Y = " << Y << endl << endl; char Karakter = 'A';
  • 3. char* Teks = "Kata"; char TEKS[39] = "Teks dengan batas sebanyak 39 karakter"; cout << Karakter << endl; cout << Teks << endl; cout << TEKS << endl << endl; return (0); } //Modul 2-2 //Konversi type data #include <iostream> using namespace std; int main() { char Karakter = 'D'; cout << "Karakter D = " << Karakter << endl; cout << "Nilai ASCII = " << (int) Karakter << endl; return (0); } // Modul 2-3 // Konstanta #include <iostream> using namespace std; const int MAX = 10; int main() { int A[MAX]; for (int C = 0; C < MAX; C++) { A[C] = C * 7; } for (int c = 0; c < MAX; c++) { cout << A [c] << endl; } return (0); } // modul 2-4 // variabel global & lokal #include <iostream> using namespace std; int A; int main() { A = 10;
  • 4. cout << " Nilai variabel A = " << A << endl << endl; int B; B = 300; cout << " Nilai Variabel B = " << B << endl << endl; return (0); } //Modul 3-1 //Operator Assignment #include <iostream> using namespace std; int main() { int a,b; a = 20; b = 100; a = b; b = 7; cout << "a = "; cout << a; cout << endl; cout << "b = "; cout << b; cout << endl; return (0); } // modul 3-2 // operator unary #include <iostream> using namespace std; int main() { int e,g; double f,h; e = +8; f = -3.14; cout << "Nilai e : " << e << endl; cout << "Nilai f : " << f << endl; g = -e; h = -f; cout << "Nilai g : " << g << endl; cout << "Nilai h : " << h << endl; return (0);
  • 5. } // modul 3-3 // increment #include <iostream> using namespace std; int main() { int i,j; i = 5; cout << "Nilai i awal : " << i << endl; cout << "Nilai ++i : " << ++i << endl; cout << "Nilai i akhir : " << i << endl; cout << 'n'; j = 10; cout << "Nilai j awal : " << j << endl; cout << "Nilai ++j : " << ++j << endl; cout << "Nilai j akhir : " << j << endl; cout << 'n'; return (0); } // modul 3-4 // decrement #include <iostream> using namespace std; int main() { int k; float l; k = 100; l = 10.5; cout << "Nilai k awal : " << k << endl; cout << "Nilai --k : " << --k << endl; cout << "Nilai k akhir : " << k << endl; cout << 'n'; cout << "Nilai l awal : " << l << endl; cout << "Nilai l-- : " << l-- << endl; cout << "Nilai l akhir : " << l << endl; return (0); } //modul 4-1 //operator aritmatika #include <iostream> using namespace std;
  • 6. int main() { cout << "2 + 3 = " << 2 + 3 << endl << endl; cout << "10 - 5 = " << 10 - 5 << endl << endl; cout << "4 x 3 = " << 4 * 3 << endl << endl; cout << "4 / 2 = " << 4 / 2 << endl << endl; cout << "10 % 3 = " << 10 % 3 << endl << endl; return (0); } // modul 4-2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { std::cout << " OPERASI OPERATOR LOGIKA n"; cout << "n Tabel Kebenaran operator AND n"; cout << " 1 && 1 = " << (1 && 1) << endl; cout << " 1 && 0 = " << (1 && 0) << endl; cout << " 0 && 1 = " << (0 && 1) << endl; cout << " 0 && 0 = " << (0 && 0) << endl; cout << "n Tabel Kebenaran operator OR n"; cout << " 1 || 1 = " << (1 || 1) << endl; cout << " 1 || 0 = " << (1 || 0) << endl; cout << " 0 || 1 = " << (0 || 1) << endl; cout << " 0 || 0 = " << (0 || 0) << endl; cout << "n Tabel Kebenaran operator NOT n"; cout << " !1 = " << !1 << endl; cout << " !0 = " << !0 << endl << "n"; return (0); } // Modul 4-3 // Operator Bitwise #include <iostream> using namespace std; int main() { int U, V, W; U = 1 << 1;
  • 7. V = 1 << 2; W = 1 << 3; cout << "1 << 1 = " << U << endl; cout << "1 << 2 = " << V << endl; cout << "2 << 3 = " << W << endl << endl; int X, Y, Z; X = 16 >> 1; Y = 16 >> 2; Z = 16 >> 3; cout << "16 >> 1 = " << X << endl; cout << "16 >> 2 = " << Y << endl; cout << "16 >> 3 = " << Z << endl << endl; int A = 1; int B = 0; cout << "A = " << A << endl; cout << "B = " << B << endl; cout << "!A = " << !A << endl; cout << "!B = " << !B << endl; cout << "A & B = " << (A & B) << endl; cout << "A | B = " << (A | B) << endl; cout << "A ^ B = " << (A ^ B) << endl << endl; return 0; } // modul 4-4.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int X; cout << "Masukkan Nilai X = "; cin >> X; cout << 'n'; X = (X < 0) ? -X : X; cout << "|X| = " << X; cout << "n n"; return 0; } //project 5-1 : Pencabangan IF // Nama : Dendi #include <iostream> #include <string> using namespace std; int main() { cout << "Kelulusan Siswa n n"; double Nilai_Ujian; cout << "Masukkan Nilai Ujian : ";
  • 8. cin >> Nilai_Ujian; cout << endl; char Hasil_Ujian[12] = "Tidak Lulus"; if (Nilai_Ujian >= 60) strcpy (Hasil_Ujian, "Lulus"); cout << "Hasil Ujian : " << Hasil_Ujian << endl << endl; return (0); } // Project 5-2 : Pencabangan Dua Kondisi (IF_ELSE) // Nama : Dendi Riadi #include <iostream> using namespace std; int main() { cout << "KELULUSAN SISWA n n "; double Nilai_Ujian; cout << "Msukkan Nilai Ujian : "; cin >> Nilai_Ujian; cout << endl; if (Nilai_Ujian >= 60) { cout << ("Hasil Ujian = LULUS") << endl << endl; } else { cout << "Hasil Ujian = TIDAK LULUS" << endl << endl; } return (0); } //modul 5-3 : pencabangan IF bersarang // Nama : Dendi Riadi #include <iostream> using namespace std; int main() { double Nilai_Ujian; char Indeks; cout << " KONVERSI NILAI SISWA n n"; cout << " Masukkan Nilai Ujian : "; cin >> Nilai_Ujian; cout << endl; if (Nilai_Ujian >= 85){ Indeks = 'A';} else
  • 9. if (Nilai_Ujian >= 75){ Indeks = 'B';} else if (Nilai_Ujian >= 55){ Indeks = 'C';} else if (Nilai_Ujian >= 40){ Indeks = 'D';} else { Indeks = 'E';} cout << "Indeks Siswa = " << Indeks << endl; return (0); } // Project 5-4 : Pernyataan Switch // Nama : Dendi Riadi #include <iostream> using namespace std; int main () { int pilihan; cout << "Staff pengajar pemrograman C++ :" << endl; cout << "================================" << endl; cout << "1. Dr. Ary Setijadi Prihatmanto" << endl; cout << "2. Dr. Aciek Ida Wuryandarin"; cout << "3. Dr. Pranoto Rusmin"; cout << "n4. Hendrayana, MT" << endl; cout << "5. Marisa Paryasto, MT" << endl; cout << "6. Kusprasapta Mutijarsa, MT" << endl; cout << "7. Syahban Rangkuti, MT" << endl; cout << "8. Reza Darmakusuma, MT" << endl; cout << "9. Ferlin Ashadi, MTn"; cout << "10.Amiratusyadiah, MT" << endl << endl; cout << "Staff pengajar Pemrograman C++ : "; cin >> pilihan; cout << endl; switch (pilihan) { case 1: cout << "Pilihan anda salahn" << endl; break; case 2: cout << "Pilihan anda benarn" << endl; break; case 3: cout << "Pilihan anda salahn" << endl; break; case 4: cout << "Pilihan anda salahn" << endl; break; case 5: cout << "Pilihan anda benarn" << endl; break; case 6: cout << "Pilihan anda salahn" << endl; break; case 7:
  • 10. cout << "Pilihan anda benarn" << endl; break; case 8: cout << "Pilihan anda benarn" << endl; break; case 9: cout << "Pilihan anda salahn" << endl; break; case 10: cout << "Pilihan anda benarn" << endl; break; default: cout << "Pilihan anda tidak ada dalam daftarnn"; } return (0); } // Modul 6-1 // Nama : Dendi Riadi #include <iostream> using namespace std; int main() { int pencacah = 1; do { cout << " D4 - Teknologi Media Digital n" ; pencacah++ ; } while (pencacah <= 10); return (0); } // modul 6-2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int pencacah = 1; do { cout << " TEKNIK KOMPUTER & MULTIMEDIA n" << endl; cout << " POLITEKNIK PAJAJARAN n" << endl << endl; pencacah++ ; } while (pencacah <=6); return 0; } // modul 6-3.cpp : Defines the entry point for the console application. // #include "stdafx.h"
  • 11. #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { cout << "PENGULANGAN MENAIK" << endl; for (int C=0; C<10; C++){ cout << C+1 << endl; } cout << 'n'; cout << "PENGULANGAN MENURUN " << endl; for (int D=10; D>0; D--){ cout << D << endl; } return 0; } // modul 6-4.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { for (int j=1; j<=10; j++){ for (int k=1; k<=j; k++){ cout << k*j << ' '; } cout << 'n'; } return 0; }