#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <math.h>
int main(void)
{
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 1 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 1 Mencari Luas persegi Panjang +";
cout <<"\n+ ________________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | Luas = Panjang x Lebar | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~ +\n";
float a, b, c;
printf( "+ Panjang : " );scanf( "%f", &a );
printf( "+ Lebar : " );scanf( "%f", &b );
c = a*b;
printf( "+ Luas = %f\n", c );
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke soal no, 2 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 1 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 2 Mencari Luas Lingkaran +";
cout <<"\n+ ___________________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | Luas = 3,14 x r (kuadrat) | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\n";
float a, b;
printf( "+ Jari-jari : " );scanf( "%f", &a );
b = 3.14 * (a * a);
printf( "+ Luas Lingkaran = %f\n", b );
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke soal no, 3 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 1 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 3 Mencari Volume Bola +";
cout <<"\n+ __________________________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | Volume = (4 x r (pangkat 3)) : 3 | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\n";
float a, b;
printf( "+ Jari-jari : " );scanf( "%f", &a );
b = (4 * (a*a*a) / 3;
printf( "+ Volume = %f\n", b );
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke soal no, 4 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 1 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 4 Mencari Nilai Rata-rata dari 3 Bilangan +";
cout <<"\n+ _________________________________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | Nilai rata-rata = (Nilai 1 + 2 + 3) / 3 | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\n";
float a, b, c, d;
printf( "+ Nilai 1 : " );scanf( "%f", &a );
printf( "+ Nilai 2 : " );scanf( "%f", &b );
printf( "+ Nilai 3 : " );scanf( "%f", &c );
d = (a + b + c) / 3;
printf( "+ Nilai Rata-rata = %f\n", d );
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke soal no, 5 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 1 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 5 Mencari Luas Trapesium +";
cout <<"\n+ _________________________________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | Luas = ((jmlh sisi yg sejajar) * t) / 2 | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\n";
float a, b, c, d;
printf( "+ Panjang Alas : " );scanf( "%f", &a );
printf( "+ Panjang Bawah : " );scanf( "%f", &b );
printf( "+ Panjang Tinggi : " );scanf( "%f", &d );
c = ((a+b)*t)/2;
printf( "+ Luas Trapesium = %f\n", c );
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke soal no, 6 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 1 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 6 Buatlah algoritma dan Program dalam bahasa C +";
cout <<"\n+ yang outputnya sebagai berikut : +";
cout <<"\n+ ________________________________ +";
cout <<"\n+ | Masukan Nilai x : | +";
cout <<"\n+ | Masukan Nilai y : | +";
cout <<"\n+ | Operasi x + y : | +";
cout <<"\n+ | Operasi x - y : | +";
cout <<"\n+ | Operasi x * y : | +";
cout <<"\n+ | Operasi x : y : | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\n";
float a, b, c;
printf( "+ Nilai x : " );scanf( "%f", &a );
printf( "+ Nilai y : " );scanf( "%f", &b );
c = a + b;
printf( "+ Hasil x + y = %f\n", c );
c = a - b;
printf( "+ Hasil x - y = %f\n", c );
c = a * b;
printf( "+ Hasil x x y = %f\n", c );
c = a / b;
printf( "+ Hasil x : y = %f\n", c );
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke Tugas Praktikum C++ Dasar 2 : ");scanf("%s", &x);
clrscr();
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Batas Tugas Praktikum ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 2 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 1 Pertukaran isi gelas A denga gelas B +";
cout <<"\n+ +";
cout <<"\n+ Jawaban : +\n";
char a[10], b[10];
printf( "+ Gelas A berwarna : " );scanf( "%s", &a );
printf( "+ Gelas B berwarna : " );scanf( "%s", &b );
printf( "\n+ Jika ditukar maka hasilnya adalah : \n\n");
printf( "+ Warna %s adalah : Gelas A\n", b );
printf( "+ Warna %s adalah : Gelas B", a );
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke Soal no. 2 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 2 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 2 Buatlah program bahasa C untuk menentukan harga +";
cout <<"\n+ Suatu barang yang di beli seorang pedagang. +";
cout <<"\n+ Peagang tersebut mengambil keuntungan 10% dari +";
cout <<"\n+ setiap barang yang dibeli. Data yang diimputkan +";
cout <<"\n+ adalah Nama barabang dan Harga beli, sedangkan +";
cout <<"\n+ outputnya adalah Nama barang dan HArga jual : +";
cout <<"\n+ +";
cout <<"\n+ _______________________________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | H. jual = H. beli - (10% dr H. beli) | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +";
cout <<"\n+ +";
cout <<"\n+ +\n";
int a, b;
char c[20];
printf( "+ Nama barang : " );scanf( "%s", &c );
printf( "+ Harga beli : " );scanf( "%d", &a );
b = a - (a/10);
printf( "\n+ Jadi harga jualnya : %d -----> dengan Nama barangnya %s\n", b, c );
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke Soal no. 3 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 2 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 3 Buatlah program bahasa C untuk menghitung +";
cout <<"\n+ pendapatan sebuah Rental CD, jika diketahui sewa +";
cout <<"\n+ 1 buah CD adalah Rp. 5000,-. Data yang diimputkan +";
cout <<"\n+ adalah No. anggota, Judul CD, Jumlah CD, dan +";
cout <<"\n+ outputnya adalah Pendapatan : +";
cout <<"\n+ +";
cout <<"\n+ ______________________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | pendapatan = jml CD * 5.000 | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +";
cout <<"\n+ +";
cout <<"\n+ +\n";
char a[20], b[20];
long int c, d;
printf( "+ Masukan No. ID : " );scanf( "%s", &a );
printf( "+ Masukan Judul CD : " );scanf( "%s", &b );
printf( "+ Jumlah CD yang diambil : " );scanf( "%ld", &c );
d = c * 5000;
printf( "+ Jadi Pendapatan Rental CD adalah : Rp.%ld,-", d);
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke Soal no. 4 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 2 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 4 Buatlah program bahasa C untuk mengkonversiakan +";
cout <<"\n+ total detik kedalam jam, menit dan detik. Data +";
cout <<"\n+ yang diinputkan adalah total detik, dan outputnya +";
cout <<"\n+ adalah jam, menit, menit dan detik hasil konversi +";
cout <<"\n+ +";
cout <<"\n+ ____________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | 1 jam = 60 menit | +";
cout <<"\n+ | 1 menit = 60 detik | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~ +";
cout <<"\n+ +";
cout <<"\n+ +\n";
int a, d, m, j;
printf( "+ Masukan jumlah detik : ");scanf("%d", &d);
j = d/3600;
m = (d%3600)/60;
printf( "+ Maka jam menunjukan pukul %d lewat %d menit\n", j, m);
a = (j*60)+m;
printf( "+ Jika diubah dalam menit maka %d detik : %d menit", d, a);
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke Soal no. 5 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 2 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 5 Buatlah program bahasa C untuk menghitung biya +";
cout <<"\n+ yang hrus dibayar seorang penelpon di Wartel. +";
cout <<"\n+ 1 pulsa = 5 detik, dan biaya 1 pulsa Rp. 300,-. +";
cout <<"\n+ Data inputanya adalah jam mulai dan jam selesai, +";
cout <<"\n+ Outputnya adalah biaya yang harus dibayar, lama +";
cout <<"\n+ percakapan dalam jam, menit, detik : +";
cout <<"\n+ +";
cout <<"\n+ ____________________ +";
cout <<"\n+ | Rumus : | +";
cout <<"\n+ | 1 jam = 60 menit | +";
cout <<"\n+ | 1 menit = 60 detik | +";
cout <<"\n+ | 1 pulsa = 5 detik | +";
cout <<"\n+ | 1 pulsa = Rp. 300 | +";
cout <<"\n+ ~~~~~~~~~~~~~~~~~~~~ +";
cout <<"\n+ +";
cout <<"\n+ +\n";
long int jm, js, j, mm, ms, m, dm, ds, d, a, b, c, rp;
printf( "+ Jam mulai press spasi for insert mnt n dtk : ");scanf("%ld %ld %ld", &jm, &mm, &dm);
printf( "+ Jam selesai press spasi for insert mnt n dtk : ");scanf("%ld %ld %ld", &js, &ms, &ds);
j = js-jm;
m = ms-mm;
d = ds-dm;
a = j*3600;
b = m*60;
c = (a+b+d)/5;
rp = c * 300;
printf( "+ Lama panggilan keluar %ld jam : %ld menit : %d detik\n", j, m, d);
printf( "+ Jadi biaya yang harus dibayar adalah : Rp.%ld,- ", rp);
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke Tugas Praktikum C++ Dasar 3 : ");scanf("%s", &x);
clrscr();
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Batas Tugas Praktikum ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 3 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 1 Program menentukan suhu +";
cout <<"\n+ +";
cout <<"\n+ +\n";
float input, f1, r1, k1, c2, r2, k2, c3, f3, k3, c4, r4, f4;
char huruf;
printf( "+ Masukan nilai derajat spasi simbol derajat : " );scanf("%f %c", &input, &huruf);
{ /* rumus jika diketahui derajat celcius-nya */
f1 = ((input*9)/5)+32;
r1 = (input*4)/5;
k1 = input+273;
/* rumus jika diketahui derajat farenhite-nya */
c2 = ((input-32)*5)/9;
r2 = ((input-32)*4)/9;
k2 = c2+273;
/* rumus jika diketahui derajat reamur-nya */
c3 = (input*5)/4;
f3 = ((input*9)/4)+32;
k3 = c3+273;
/* rumus jika diketahui derajat kelvin-nya */
c4 = input-273;
f4 = ((c4*9)/5)+32 ;
r4 = (c4*4)/5 ;
{ if(huruf=='c')
printf( "+ Maka :\n+ %f %c = %f F\n+ %f %c = %f R\n+ %f %c = %f K\n", input, huruf, f1, input, huruf, r1, input, huruf, k1);
else
if(huruf=='f')
printf( "+ Maka :\n+ %f %c = %f C\n+ %f %c = %f R\n+ %f %c = %f K\n", input, huruf, c2, input, huruf, r2, input, huruf, k2);
else
if(huruf=='r')
printf( "+ Maka :\n+ %f %c = %f C\n+ %f %c = %f F\n+ %f %c = %f K\n", input, huruf, c3, input, huruf, f3, input, huruf, k3);
else
if(huruf=='k')
printf( "+ Maka :\n+ %f %c = %f C\n+ %f %c = %f R\n+ %f %c = %f R\n", input, huruf, c4, input, huruf, f4, input, huruf, r4);
else
printf("+\n+ sorry memory corrupt +");
}
}
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke Soal no. 2 : ");scanf("%s", &x);
clrscr();
}
{
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Tugas Praktikum C++ Dasar 3 +";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
cout <<"\n+ Soal No. 2 Program Untuk membaca bilangan bulat, lalu +";
cout <<"\n+ mengurutkan ketiga bilangan tersebut kedalam +";
cout <<"\n+ dari nilai yang kecil ke nilai yang besar. +";
cout <<"\n+ Keluaran adalah tiga buah bil yang terurut. +";
cout <<"\n+ +";
cout <<"\n+ +\n";
cout <<"\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n";
char x;
printf("Ketik d dan tekan enter untuk melanjutkan ke Soal no. 3 : ");scanf("%s", &x);
clrscr();
}
getch();
return 0;
}
Woke, Semoga bermanfaat,
Salam senyum dariku........
alam senyum dariku untuk semuanya, tetaplah untuk bersemangat. Jangan lupa atau isi buku tamu ya sob. Sedikit pemberitahuan untuk sobat yang ingin mengambil [Copy-Paste], Owner tidak melarang sobat untuk memperbanyak artikel namun Owner berharap sobat berlaku dengan bijak agar mencantumkan link active maupun yang tidak. Owner berharap partisipasinya ya sob.
0 komentar: