KEJAR TERUS SAMPAI DAPAT
SOAL 3
3. Selesaikanlah pengurutan dengan menggunakan methode BUBLE SORT
NPM: 1011754 MODULE 5 = 4
Tipe 4 : 40, 99, 60, 30, 45, 16
Penyelesaian:
Kasus : Tipe 4 : 40, 99, 60, 30, 45, 16
i=0 j=5 -> T: 40, 99, 60, 30, 16, 45
j=4 -> T: 40, 99, 60, 16, 30, 45
j=3 -> T: 40, 99, 16, 60, 30, 45
j=2 -> T: 40, 16, 99, 60, 30, 45
j=1 -> T: 16, 40, 99, 60, 30, 45
i=1 j=5 -> F: 16, 40, 99, 60, 30, 45
j=4 -> T: 16, 40, 99, 30, 60, 45
j=3 -> T: 16, 40, 30, 99, 60, 45
j=2 -> T: 16, 30, 40, 99, 60, 45
i=2 j=5 -> T: 16, 30, 40, 99, 45, 60
j=4 -> T: 16, 30, 40, 45, 99, 60
i=3 j=5 -> T: 16, 30, 40, 45, 60, 99
Pembelajaran ku
Sangat Lah Menyenangkan
Pokok nya Best of the best lah
Meski Membuat Wajah Jadi Keriput
Tugas Ke 5 Program C++ Hasil Input Data Siswa
include "conio.h"
#include "iostream.h"
#include "stdio.h"
struct siswa {
char nis[8];
char nama[30];
int tahun ;
} rsiswa[40];
void main(){
int i=0,j;
char lg;
long uang ;
do{
gotoxy(10,5);cout<<"input data siswa ";
gotoxy(10,6);cout<<"-----------------";
gotoxy(10,7);cout<<"Nis :";gets(rsiswa[i].nis);
gotoxy(10,8);cout<<"Nama :";gets(rsiswa[i].nama);
gotoxy(10,9);cout<<"tahun :";cin>>rsiswa[i].tahun;
gotoxy(10,10);cout<<"input lagi[Y/T]:";cin>>lg;
clrscr();i++;
}while(lg=='Y'|| lg=='y');
gotoxy(5,2);cout<<"laporan dta siswa";
gotoxy(5,3);cout<<"-----------------";
gotoxy(5,4);cout<<" No Nis Nama Tahun Uang Sekolah ";
gotoxy(5,5);cout<<"-----------------";
for(j=0;j switch(rsiswa[j].tahun){
case 2008:uang=100.000;break;
case 2009:uang=175.000;break;
case 2010:uang=200.000;break;
depault :uang=0;
}
gotoxy(5,6+j);cout<
}
HENDRA BLOG: Tugas Ke 4 Program C++ Hasil Penjualan Barang/Prod...
HENDRA BLOG: Tugas Ke 4 Program C++ Hasil Penjualan Barang/Prod...: "#include #include #include #include #include void main() { char kd; char nm[30]; char *nama; char *jenis; int jumlah, jns; float..."
Tugas Ke 4 Program C++ Hasil Penjualan Barang/Produk
#include
#include
#include
#include
#include
void main()
{
char kd;
char nm[30];
char *nama;
char *jenis;
int jumlah, jns;
float harga=0;
long total;
char lagi='y';
clrscr();
while(lagi=='Y'||lagi=='y')
{
gotoxy(10,5);
cout<<"penjualan barang elektronik\n";
gotoxy(10,6);
cout<<"------------------------------\n";
gotoxy(10,7);
cout<<"nama pembeli="; cin>>nm;
gotoxy(10,8);
cout<<"kode barang[A/B/C]="; cin>>kd;
gotoxy(10,9);
cout<<"jenis bayar[1. tunai/2. kredit]="; cin>>jns;
gotoxy(10,10);
cout<<"-------------------------------\n";
if((kd=='A'||kd=='a')&&(jns==1))
{
nama="televisi";
jenis="tunai";
harga=500000;
}
else if((kd=='A'||kd=='a')&&(jns==2))
{
nama="televisi";
jenis="kredit";
harga=650000;
}
else if((kd=='B'||kd=='b')&&(jns==1))
{
nama="kipas angin";
jenis="tunai";
harga=150000;
}
else if((kd=='B'||kd=='b')&&(jns==2))
{
nama="kipas angin";
jenis="kredit";
harga=250000;
}
else if((kd=='C'||kd=='c')&&(jns==1))
{
nama="VCD";
jenis="tunai";
harga=300000;
}
else if((kd=='C'||kd=='c')&&(jns==2))
{
nama="VCD";
jenis="kredit";
harga=450000;
}
else
{
nama="_";
jenis="_";
harga=0;
}
gotoxy(10,11);
cout<<"Nama barang="<
cout<<"jenis bayar="<
cout<<"harga barang="<
cout<<"jumlah beli="; cin>> jumlah;
total=harga*jumlah;
gotoxy(10,15);
cout<<"total bayar="<
cout<<"--------------------";
gotoxy(10,17);
cout<<"masih mau beli barang lagi[y/t]="; cin>>lagi;
clrscr();
}
}
Tugas Ke 3 Program Java.
class Lat3{
public static void main(String Arg[]) throws IOException{
String str;
String nm;
int ttlhrg;
int hrg;
int kde;
int jlh;
BufferedReader Get=new BufferedReader(new
InputStreamReader(System.in));
System.out.print(" Kode : "); str=Get.readLine();
kde = Integer.parseInt(str);
switch(kde){
case 1 : nm= "Televisi" ; hrg= 1750000;
break;
case 2 : nm= "DVD" ; hrg= 750000;
break;
case 3 : nm= "CD Rom" ; hrg= 450000;
break;
default:
nm= ""; hrg= 0 ;
}
System.out.println(" Nama : " + nm);
System.out.println(" Harga : " + hrg);
System.out.print(" Jumlah : "); str=Get.readLine();
jlh = int.parslnt (string);
ttlhrg = jlh * hrg ;
System.out.println(" Total Harga : " + ttlhrg);
}
}
Tugas Ke 2. Menghitung p,l,s,pil,r; Lingkaran Dan Persegi Panjang
#include "stdio.h"
#include "conio.h"
#include "iostream.h"
void main(){
int p,l,s,pil,r;
float ls,vol;
do {
clrscr();
gotoxy(20,5);cout<<"menu";
gotoxy(20,6);cout<<"1.hitung volume";
gotoxy(20,7);cout<<"2.hitung luas lingkaran";
gotoxy(20,8);cout<<"3.hitung luas pp";
gotoxy(20,9);cout<<"4.keliling lingkarang";
gotoxy(20,10);cout<<"5.keliling persegi panjang";
gotoxy(20,11);cout<<"6.keluar";
gotoxy(20,12);cout<<"pilihan:";cin>>pil;
clrscr();
switch(pil){
case 1:
gotoxy(20,5);cout<<"hitung volume";
gotoxy(20,6);cout<<"sisi";
cin>>s;
vol=s*s*s;
gotoxy(20,7);cout<<"volume:"<<vol;
break;
case 2:
gotoxy(20,5);cout<<"hitung luas lingkaran";
gotoxy(20,6);cout<<"jari-jari";
cin>>r;
ls=3.14*r*r;
gotoxy(20,7);cout<<"luas lingkaran:"<<ls;
break;
case 3:
gotoxy(20,5);cout<<"hitung luas persegi panjang";
gotoxy(20,6);cout<<"panjang";cin>>p;
gotoxy(20,7);cout<<"lebar";cin>>l;
ls=p*l;
gotoxy(20,8);cout<<"luas persegi panjang:"<<ls;
break;
case 4:
gotoxy(20,5);cout<<"keliling lingkaran";
gotoxy(20,6);cout<<"jari-jari";cin>>r;
ls=2*3.14*r;
gotoxy(20,7);cout<<"lingkaran"<<l;
break;
case 5:
gotoxy(20,5);cout<<"keliling persegi panjang";
gotoxy(20,6);cout<<"panjang";cin>>p;
gotoxy(20,7);cout<<"lebar";cin>>l;
ls=2*p+2l;
gotoxy(20,8);cout<<"keliling persegi panjang"<<ls;
break;
}
getche();
}while(pil !=6);
}
Tugas Pertama ku C++ Menghitung P.L.S Persegi Panjang Oleh Pak Mesran
#include "conio.h"
#include "stdio.h"
void main(){
int p,l,s; int pil;
float ls,vol;
gotoxy(20,1);printf("menu");
printf("\n hitung luas");
printf("\n1 hitung volume");
printf("\n2 pilihan");
scanf("%d",& pil);
if(pil==1){
clrscr();
printf("menghitung luas");
printf("\n lebar`:");
scanf("%d",&p);
printf("\panjang`:");
scanf("%d",&l);
ls=p*l;
printf("luas :%2f",ls);
}else {
clrscr();
printf("sisi :");
scanf("%d",&s);
vol=s*s*s;
printf("\n volume :%2f",vol);
}
}