Anda di halaman 1dari 5

# 


#include <iostream>
using namespace std;
int main()
{
int program;
float alas, tinggi, sisi, panjang, lebar, jari_jari, segitiga1,
segitiga2, persegi1, persegi2, lingkaran1,lingkaran2;
cout<<" 1 = Luas dan Keliling Segitiga"<<endl;
cout<<" 2 = Luas dan Keliling Persegi Panjang"<<endl;
cout<<" 3 = Luas dan Keliling Lingkaran"<<endl;

switch (program)
{
case 1 :
cout<<"Masukkan Alas \t: ";cin>>alas;
cout<<"Masukkan Tinggi \t: ";cin>>tinggi;
cout<<"Masukkan Sisi \t: "<<sisi<<endl;
segitiga1=0.5*alas*tinggi;
segitiga2=alas+tinggi+sisi;
cout<<"Luas \t\t\t= "<<segitiga1<<endl;
cout<<"Keliling \t\t= "<<segitiga2<<endl;
break;
}
switch (program)
{
case 2 :
cout<<"Masukkan Panjang \t: ";cin>>panjang;
cout<<"Masukkan Lebar \t\t: ";cin>>lebar;
persegi1=panjang*lebar;
persegi2=2*(panjang+lebar);
cout<<"Luas \t\t\t= "<<persegi1<<endl;
cout<<"Keliling \t\t= "<<persegi2<<endl;
break;
}
switch (program)
{
case 3 :
cout<<"Masukkan Jari-Jari \t: ";cin>>jari_jari;
lingkaran1=3.14*(jari_jari*jari_jari);
lingkaran2=2*3.14*jari_jari;
cout<<"Luas \t\t\t= "<<lingkaran1<<endl;
cout<<"Keliling \t\t= "<<lingkaran2<<endl;
break;
}
return 0;
}
Compile & Run:
#include <iostream>
/*===============================
Menghitung Nilai Akhir Ujian Anda
===============================*/
using namespace std;
int main()
{
//Variable
int k1, k2, u, p, cp1, cp2, na;
float proses_20 = 20, proses_40 = 40, cp2_40 = 40, cp1_60 = 60;
//Input nilai proses
cout<<"=========================================="<<endl;
cout<<"Masukan Nilai Akhir Mata Kuliah Ujian Anda"<<endl;
cout<<"=========================================="<<endl;
cout<<"Nilai Kuis Pertama Anda\t\t:";cin>>k1;
k1=k1*proses_20/100;
cout<<"Nilai Kuis Kedua Anda\t\t:";cin>>k2;
k2=k2*proses_20/100;
cout<<"Nilai Ujian Anda\t\t:";cin>>u;
u=u*proses_20/100;
cout<<"Nilai Praktikum Anda\t\t:";cin>>p;
p=p*proses_40/100;
cout<<"Nilai Capaian Pembelajaran 1\t:";cin>>cp1;
cp1=cp1*cp1_60/100;
cout<<"Nilai Capaian Pembelajaran 2\t:";cin>>cp2;
cp2=cp2*cp2_40/100;
cout<<"=========================================="<<endl;
//proses ending
na=(k1+k2+u+p+cp1+cp2)/2;
//Input cp1 & cp2

## //Output nilai proses

cout<<"=========================================="<<endl;
cout<<"Nilai Kuis Pertama\t\t:"<<k1<<endl;
cout<<"Nilai Kuis Kedua\t\t:"<<k2<<endl;
cout<<"Nilai Ujian\t\t\t:"<<u<<endl;
cout<<"Nilai Praktikum\t\t\t:"<<p<<endl;
cout<<"Nilai Proses Anda\t\t:"<<na<<endl;
cout<<"=========================================="<<endl;
//Output cp1 & cp2
cout<<"=========================================="<<endl;
cout<<"Nilai Capaian Pembelajaran 1\t:"<<cp1<<endl;
cout<<"Nilai Capaian Pembelajaran 2\t:"<<cp2<<endl;
cout<<"=========================================="<<endl;
//Output total proses+cp
switch (na)
case 90 ... 100 :
{
cout<<"Nilai IPK Anda Adalah = A"<<endl;
}
switch (na)
case 80 ... 89 :
{
cout<<"Nilai IPK Anda Adalah = B+"<<endl;
}
switch (na)
case 70 ... 79 :
{
cout<<"Nilai IPK Anda Adalah = B"<<endl;
}
switch (na)
case 60 ... 69 :
{
cout<<"Nilai IPK Anda Adalah = C+"<<endl;
}
switch (na)
case 50 ... 59 :
{
cout<<"Nilai IPK Anda Adalah = C"<<endl;
}
switch (na)
case 40 ... 49 :
{
cout<<"Nilai IPK Anda Adalah = D"<<endl;
}
switch (na)
case 0 ... 39 :
{
cout<<"Nilai IPK Anda Adalah = E"<<endl;
}
return 0;
}
Compile & Run:

### Dapatkan aplikasi gratis kami

Hak cipta © 2021 Scribd Inc.