Berikut Video Tutorialnya :
Source Code Program Pencabangan if Satu Kondisi :
/*Project 5-1
Pencabangan if
Nama Vidia Handayani */
# include <iostream>
# include <string>
using namespace std;
int main (void)
{
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;
system ("pause");
return 0;
}
Source Code Program Pencabangan if Dua Kondisi :
/*Project 5-2
Pencabangan Dua Kondisi (IF-ELSE)
Nama : Vidia Handayani*/
#include <iostream>
using namespace std;
int main(void)
{
cout << " KELULUSAN SISWA \n \n" ;
double Nilai_Ujian;
cout << "Masukkan 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;
}
system ("pause");
return 0;
}
Source Code Program Pencabangan If Bersarang :
/* Project 5-3 :
Percabangan If Bersarang
Nama : Vidia Handayani
*/
#include <iostream>
using namespace std;
int main(void)
{
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;
system ("pause");
return 0;
}
Source Code Program Pernyataan Switch :
/*Project 5-4 :
Pernyataan Switch
Nama : Vidia Handayani*/
#include <iostream>
using namespace std;
int main (void)
{
int pilihan;
cout << "Staff Pengajar Pemrograman C++ :" << endl;
cout << "================================" << endl;
cout << "1. Dr. Ary Setijadi Prihatmanto" << endl;
cout << "2. Dr. Aciek Ida Wuryandari\n";
cout << "3. Dr. Pranoto Rusmin";
cout << "\n4. Dr. Hilwadi Hindersah" << 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, MT\n";
cout << "10.Harry Septanto, MT" << endl << endl;
cout << "Staff Pengajar Pemrograman C++ : ";
cin >> pilihan;
cout << endl;
switch (pilihan)
{
case 1:
cout << "Pilihan anda salah\n" << endl;
break;
case 2:
cout << "Pilihan anda benar\n" << endl;
break;
case 3:
cout << "Pilihan anda salah\n" << endl;
break;
case 4:
cout << "Pilihan anda salah\n" << endl;
break;
case 5:
cout << "Pilihan anda benar\n" << endl;
break;
case 6:
cout << "Pilihan anda salah\n" << endl;
break;
case 7:
cout << "Pilihan anda benar\n" << endl;
break;
case 8:
cout << "Pilihan anda benar\n" << endl;
break;
case 9:
cout << "Pilihan anda salah\n" << endl;
break;
case 10:
cout << "Pilihan anda benar\n" << endl;
break;
default:
cout << "Pilihan anda tidak ada dalam daftar\n\n";
}
system ("pause");
return 0;
}
Selamat belajar :)
No comments:
Post a Comment