free registration html
PERTEMUAN 8 FREE REGISTRATION
Latihan atau tugas Free Registration NAMA : Tgl Lahir: Alamat : Kota : Pekerjaan: Programer Data ANALISIS IT Su...
Senin, 11 April 2022
Senin, 28 Maret 2022
Pertemuan 1 Instalasi Android Studio
untuk mendownload Aplikasi Android Studio bisa di download dengan masuk ke link berikut
- Download Android Studio
4. Tentukan Lokasi Instalasi
5. Tentukan Nama Aplikasi Android Studio
6. Mulai Proses Instalasi
7. Pilih Tampilan Android Studio
9. Pilih Komponen SDK Tambahan
10. Tentukan RAM untuk Emulator
11. Review Pengaturan Instalasi
12. Proses Download dan Install SDK Android Studio
Setelah proses download dan install selesai, akan muncul tampilanseperti gambar di bawah ini.
Selasa, 01 Februari 2022
luas persegi panjang
#include <iostream>
using namespace std;
int main()
{
int bil, i;
bool Prima = true;
cout << "Masukan bilangan bulat positif: ";
cin >> bil;
for(i = 2; i <= bil / 2; ++i)
{
if(bil % i == 0)
{
Prima = false;
break;
}
}
if (Prima)
cout << "Bilangan tersebut adalah bilangan prima.";
else
cout << "Bilangan tersebut bukan bilangan prima.";
return 0;
}
tugas pertemuan 2
#include <iostream>
#include <conio.h>
using namespace std;
int main ()
{
int Nilai [10];
int i, Jumlah =0;
float Rata_Rata;
cout<<"Tugas Pertemuan 2"<<endl;
cout<<"Nama :Muhamad Husni Ramadhan"<<endl;
cout<<"Nim :191011400011"<<endl;
cout<<endl;
for (i=0 ;i<10;i++)
{
cout<<"Masukan Elemen Ke-"<<i<<"=";
cin>>Nilai[i];
Jumlah+=Nilai[i];
}
Rata_Rata=(float)Jumlah/10;
cout<<"\n\n Deretan Bilangan =";
{
cout<<Nilai[i]<<"";
}
cout<<"\n Jumlah Bilangan ="<< Jumlah;
cout<<"\n Rata-Rata Bilangan ="<<Rata_Rata;
getch ();
}
tugas akhir pertemuan 11
//OFFICIALDANS.K.BLOGSPOT.COM WEDDING AND FOTOGRAFI
#include<iostream>
#include<iomanip>
#include<stdio.h>
using namespace std;
struct Employee_str
{
char ID[20],Name[25],status[15];
int anak,gaji;
char jmlh[2];
};
int main()
{
printf("NAMA : MUHAMAD HUSNI RAMADHAN\n");
printf("NIM : 191011400011 \n");
printf("KELAS: 02TPLE002 \n");
Employee_str employee[6];
int loop;
for(loop=1;loop<6;loop++)
{
cout<<"Data Karyawan 1, 2, 3, .. : ";
cin.getline(employee[loop].jmlh,80.);
cout<<"ID Karyawan : ";
cin.getline(employee[loop].ID,80.);
cout<<"Nama Karyawan : ";
cin.getline(employee[loop].Name,80.);
cout<<"Gaji/Bulan : ";
cin>>employee[loop].gaji;
cin.ignore(80,'\n');
cout<<"Status (Menikah/Belum Menikah) : ";
cin.getline(employee[loop].status,80);
cout<<"Anak (0, / 1, 2, 3, ..) : ";
cin>>employee[loop].anak;
cin.ignore(80,'\n');
cout<<endl;
}
cout<<"Data Karyawan : ";
cout<<endl;
cout.flags(ios::left);
cout<<setw(0)<<"No "<<"ID karyawan"<<" Nama "<<" Gaji "<<" Status "<<" Anak";
cout<<endl;
cout<<"================================================";
cout<<endl;
for(loop=1;loop<6;loop++)
{
cout<<setiosflags(ios::left)<<setw(5)<<loop;
cout<<setiosflags(ios::left)<<setw(10)<<employee[loop].ID;
cout<<setiosflags(ios::left)<<setw(10)<<employee[loop].Name;
cout<<setiosflags(ios::left)<<setw(10)<<employee[loop].gaji;
cout<<setiosflags(ios::left)<<setw(20)<<employee[loop].status;
cout<<setiosflags(ios::left)<<setw(12)<<employee[loop].anak;
cout<<endl;
}
cout<<endl;
return 0;
}
tugas akhir pertemuan 4
#include<iostream>
using namespace std;
main()
{
cout<<" NAMA : MUHAMAD HUSNI RAMADHAN"<<endl;
cout<<" NIM : 191011400011 "<<endl;
cout<<" KELAS : 02 TPLE 002 "<<endl;
int harga;
cout<<" Masukan Total Pembelian : Rp."; cin>>harga;
switch(harga)
{
case 100000 ... 199999:
int dis, t;
dis=harga*0.05;
t=harga-dis;
cout<<"Anda Mendapat Potongan Sebesar : Rp."<<dis;
cout<<" Total Yang Harus Dibayar : Rp."<<t; break;
case 200000 ... 299999:
cout<<"BONUS ANDA : TIKET KE YOGYA"; break;
case 300000 ... 399999:
cout<<"BONUS ANDA : TIKET KE BALI"; break;
case 400000 ... 499999:
cout<<"BONUS ANDA : JAM TANGAN ROLEX"; break;
case 500000 ... 1000000:
cout<<"BONUS ANDA : TIKET KE SWISS"; break;
}
return 0;
}
testingan
#include<iostream>
#include<iomanip>
using namespace std;
struct Employee_str
{
char Name[25],status[15],jumlah[2];
int anak,gaji;
};
int main( )
{
Employee_str employee[5];
int loop;
for(loop=0; loop<5; loop++)
{
cout<<
cout<< "NAMA " <<(loop+1)<<" : ";
cin.getline(employee[loop].Name,80, '\n');
cout<< "status: ";
cin>>employee[loop].status;
cin.ignore(80, '\n');
cout
}
cout<<"\nemployee data:\n";
cout.flags(ios::left);
cout<<setw(15)<<"Name"<<"\tID#\n_______________\n";
for(loop =0; loop<5; loop++)
{
cout<<setw(15)<<employee[loop].Name;
cout<<"\t"<<employee[loop].IdNum<<endl;
}
cout<<endl;
}
tugas akhir pertemuan 7
#include <iostream>
using namespace std;
void MergeSort(int low, int high);
void Merge(int , int , int );
int A[50];
int main()
{
int i, elemen;
cout<<"Berapa banyak elemen yang ingin disusun ? "; cin>>elemen;
cout<<endl;
cout<<"Masukkan " <<elemen<<" elemen: \n";cout<<endl;
for(i=1;i<=elemen;i++)
{
cout << "Elemen ke-"<<i<<" = ";
cin>>A[i];
}
cout<<endl;
MergeSort(1,elemen);
cout<<endl;
cout<<"Setelah di mergesort: \n\n";
for(i=1;i<=elemen;i++)
{
cout<< A[i] <<" ";
}
cout<< endl << endl;
return 0;
}
//prosedure Mergesort
void MergeSort(int low, int high)
{
int mid;
if(low<high)
{
mid = (low+high)/2;
MergeSort(low,mid);
MergeSort(mid+1, high);
Merge(low, mid, high);
}
}
//Prosedure Merge
void Merge(int low, int mid, int high)
{
int h,i,j,k,b[50];
h=low;
i=low;
j=mid+1;
while((h<=mid)&&(j<=high))
{
if(A[h]<A[j])
{
b[i]=A[h];
h++;
}else{
b[i]=A[j];
j++;
}
i++;
}
if(h>mid)
{
for(k=j;k<=high;k++)
{
b[i]=A[k];
i++;
}
}else{
for(k=h;k<=mid;k++)
{
b[i]=A[k];
i++;
}
}
for(k=low;k<=high;k++)
{
A[k]=b[k];
}
}
tugas akhir pertemuan 6
#include <iostream>
#include <conio.h>
using namespace std;
main()
{
bool ketemu;
int posisi[25];
int c,i,banyak=0;
int data[25]={34,8,50,74,87,90,12,25,20,30,35,45,40,22,29,72,60,55,53,12,32,33,12,41,12};
cout<<"Data : ";
for(i=0;i<25;i++)
{
cout<<data[i]<<" ";
}
cout<<"\n\nData yang dicari : ";
cin>>c;
for (i=0;i<25;i++)
{
if (data[i]==c)
{
ketemu=true;
posisi[banyak]=i+1;
banyak++;
}
}
if (ketemu)
{
cout<<"Data : "<<c;
cout<<"\nDitemukan sebanyak "<<banyak;
cout<<"\nPada posisi ke ";
for(i=0;i<banyak;i++)
{
cout<<posisi[i]<<" ";
}
}
else
{
cout<<"Data "<<c<<" tidak ditemukan";
}
getch();
}
tugas akhir pertemuan 5
#include <iostream>
#include <conio.h>
using namespace std;
void baris()
{
cout<<endl;
}
void nama()
{
char *nama;
nama="Muhamad HusniRamadhan";
cout<<"Nama : "<<nama;
baris ();
cout<<"Nama di alamat : "<<&nama;
}
void nim()
{
int nim = 19101140011;
int *ptr;
ptr=&nim;
cout<<"NIM : "<<nim;baris();
cout<<"NIM di alamat : "<<&nim;baris();
cout<<"Ptr di alamat : "<<&ptr;
}
main()
{
nama();
baris();baris();
nim();
getch();
}
tugas akhir pertemuan 4
#include<iostream>
#include<conio.h>
#include<windows.h>
using namespace std;
void DisplayNumbers(char *Nbr[], int r, int c);
int main()
{
system("COLOR F0");
char number[2][5] = { { 'a', 'b', 'c', 'd', 'e' },{ 'f', 'g', 'h', 'i', 'j' } };
char *pNumbers[2];
*pNumbers = number[0];
for(int i = 0; i<6; i++)
(*pNumbers)[i] = number[0][i];
*(pNumbers+1) = number[1];
for(int i = 0; i<6; i++)
(*(pNumbers+1))[i] = number[1][i];
cout<<" PROGRAM POINTER DENGAN ARRAY DUA DIMENSI"<<endl;
cout<<"Daftar Huruf"<<endl;
DisplayNumbers(pNumbers, 2, 5);
return 0;
}
void DisplayNumbers(char *nbr[], int rows, int columns)
{
for(int i = 0; i<rows; i++)
for(int j = 0; j<columns; j++)
cout<<"Indeks ke - ["<<i<<"]["<<j<<"]:"<<(*(nbr+i))[j];
}
tugas akhir pertemuan 3
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<conio.h>
#include<windows.h>
using namespace std;
struct Tinggal
{
char Jalan[50];
char Kota[15];
char Kode_Pos[5];
};
struct Tanggal
{
int Tanggal;
int Bulan;
int Tahun;
};
struct Biodata
{
char Nip[9];
char Nama[25];
char Agama[10];
char Jabatan[10];
char Unit_kerja[15];
Tinggal Alamat;
Tanggal Lahir;
Tanggal Mulai_kerja;
};
main()
{
Biodata Pegawai[5];
int i;
for(i=0; i<2; i++)
{
cout<<"\t\t\t Program Pendataan Karyawan "<<endl;
cout<<"\n \t\t=============================================\n";
cout<<"\t\tNIP \t: ";cin>>Pegawai[i].Nip;
cout<<"\t\tNama \t: ";cin>>Pegawai[i].Nama;
cout<<"\t\tAlamat \t\n";
cout<<"\t\t\tJalan \t: ";cin>>Pegawai[i].Alamat.Jalan;
cout<<"\t\t\tKota \t: ";cin>>Pegawai[i].Alamat.Kota;
cout<<"\t\t\tKode Pos: ";cin>>Pegawai[i].Alamat.Kode_Pos;
cout<<"\t\tJabatan : ";cin>>Pegawai[i].Jabatan;
cout<<"\t\tAgama \t: ";cin>>Pegawai[i].Agama;
cout<<"\t\tTanggal Lahir \n";
cout<<"\t\t\tTanggal : ";cin>>Pegawai[i].Lahir.Tanggal;
cout<<"\t\t\tBulan \t: ";cin>>Pegawai[i].Lahir.Bulan;
cout<<"\t\t\tTahun \t: ";cin>>Pegawai[i].Lahir.Tahun;
cout<<"\t\tTanggal Mulai Kerja \n";
cout<<"\t\t\tTanggal : ";cin>>Pegawai[i].Mulai_kerja.Tanggal;
cout<<"\t\t\tBulan \t: ";cin>>Pegawai[i].Mulai_kerja.Bulan;
cout<<"\t\t\tTahun \t: ";cin>>Pegawai[i].Mulai_kerja.Tahun;
cout<<"\t\tUnit Kerja : ";cin>>Pegawai[i].Unit_kerja;
}
cout<<"Cetak"<<endl;
for(i=0; i<2; i++)
{
cout<<"========================== NIP "<<Pegawai[i].Nip<<" ========================== ";
cout<<endl;
cout<<"\n Nama \t\t: "<<Pegawai[i].Nama;
cout<<"\n Alamat \t: "<<Pegawai[i].Alamat.Jalan<<" "<<Pegawai[i].Alamat.Kota<<", "<<Pegawai[i].Alamat.Kode_Pos;
cout<<"\n Jabatan \t: "<<Pegawai[i].Jabatan;
cout<<"\n Agama \t\t: "<<Pegawai[i].Agama;
cout<<"\n Tgl Lahir \t: "<<Pegawai[i].Lahir.Tanggal<<"-"<<Pegawai[i].Lahir.Bulan<<"-"<<Pegawai[i].Lahir.Tahun;
cout<<"\n Tgl Mulai Krj \t: "<<Pegawai[i].Mulai_kerja.Tanggal<<"-"<<Pegawai[i].Mulai_kerja.Bulan<<"-"<<Pegawai[i].Mulai_kerja.Tahun;
cout<<"\n Unit Kerja \t: "<<Pegawai[i].Unit_kerja;
cout<<endl;
cout<<"==============================================================\n";
}
getch();
}
tugas akhir pertemuan 2
#include <iostream>
#include <conio.h>
#include <iomanip>
using namespace std;
int i, j, baris, kolom, m1[10][10], m2[10][10], hasil[10][10];
main(){
do
{
cout<<"Jumlah Baris = ";cin>>baris;
cout<<"Jumlah Kolom = ";cin>>kolom;
}
while
((baris>10)||(kolom>10));
cout<<"\nMatrix A"<<endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++){
cout<<"data ["<<i<<","<<j<<"] = ";cin>>m1[i][j];
}
cout<<"\nMatrix B"<<endl;
for(i=0;i<baris;i++)
for(j=0;j<kolom;j++){
cout<<"data ["<<i<<","<<j<<"] = ";cin>>m2[i][j];
}
for(i=0; i<baris; i++)
for(j=0; j<kolom; j++)
hasil[i][j] = m1[i][j] + m2[i][j];
cout<<"\nHasil :"<<endl;
cout<<"\n Matrix A + Matrix B = Matrix C";
for(i=0; i< baris; i++){
cout<<'\n';for(j=0; j<kolom; j++)cout << setw(4) << m1[i][j];
cout<<" ";for(j=0; j<kolom; j++)cout << setw(4) << m2[i][j];
cout<<" ";for(j=0; j<kolom; j++)cout << setw(4) << hasil[i][j];
cout<<endl;}
getch();
}
tentang fungsi
#include<stdio.h>
//fungsi perulangan()
int main(){
for(int i = 0; i < 10; i++){
//memanggil fungsi PERULANGAN ()
printf("PERULANGAN ke-%i\n", i);
}
return 0;
}
struktur 3
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
main()
{
int i;
struct
{
int nim[100];
int nama[100];
int nilai[100];
float mhs;
} mhs[5];
for(i=1; i<=2; i++)
{
cout<<"masukan NIM = "; cin>>mhs[i].nim;
cout<<"masukan Nama = "; cin>>mhs[i].nama;
cout<<"masukan Nilai Akhir = "; cin>>mhs[i].nilai;
}
cout<<endl;
cout<<"data Mahasiswa"<<endl;
for(i=1; i<=2; i++)
{
cout<<"Data Ke – "<<i<<endl;
cout<<"NIM = "<<mhs[i].nim<<endl;
cout<<"Nama = "<<mhs[i].nama<<endl;
cout<<"Nilai Akhir = "<<mhs[i].nilai<<endl;
cout<<endl;
}
return 0;
}
struktur 2
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
int i;
struct
{
char nim[100];
char nama[100];
char nilai[100];
float mhs;
} mhs[5];
clrscr();
for(i=1; i<=2; i++)
{
cout<<"masukan NIM = "; cin>>mhs[i].nim;
cout<<"masukan Nama = "; cin>>mhs[i].nama;
cout<<"masukan Nilai Akhir = "; cin>>mhs[i].nilai;
}
cout<<endl;
cout<<"data Mahasiswa"<<endl;
for(i=1; i<=2; i++)
{
cout<<"Data Ke – "<<i<<endl;
cout<<"NIM = "<<mhs[i].nim<<endl;
cout<<"Nama = "<<mhs[i].nama<<endl;
cout<<"Nilai Akhir = "<<mhs[i].nilai<<endl;
cout<<endl;
}
return 0;
}
struktur 6
#include <iostream>
#include <conio.h>
using namespace std;
int nilai [5];
int top1, top2, menu, stack, pop;
void create()
{
top1=-1;
top2=5;
stack=1;
pop=1;
}
bool isfull()
{
if(top2-top1==1)
{
return true;
}
else
{
return false;
}
}
bool isempty1()
{
if(top1==-1)
{
return true;
}
else
{
return false;
}
}
bool isempty2()
{
if(top2==5)
{
return true;
}
else
{
return false;
}
}
void main()
{
create();
home:
clrscr();
cout<<"1. Push"<<endl;
cout<<"2. Pop"<<endl;
cout<<"3. Print"<<endl;
cout<<"4. Clear"<<endl;
cout<<"Masukkan pilihan anda (1-4) : ";
cin>>menu;
switch(menu)
{
case 1:
if(isfull()==true)
{
cout<<"Stack Penuh !";
}
else
{
if (stack==1)
{
top1++;
cout<<"Masukkan data ke stack 1 : ";
cin>>nilai[top1];
stack++;
}
else if (stack==2)
{
top2--;
cout<<"Masukkan data ke stack 2 : ";
cin>>nilai[top2];
stack--;
}
}
getch();
goto home;
break;
case 2:
if (pop==1)
{
if(isempty1()==true)
{
cout<<"Stack 1 kosong !";
}
else
{
cout<<"Nilai yang keluar dari stack 1 : "<<nilai[top1];
top1--;
pop++;
}
}
else if (pop==2)
{
if(isempty2()==true)
{
cout<<"Stack 2 kosong !";
}
else
{
cout<<"Nilai yang keluar dari stack 2 : "<<nilai[top2];
top2++;
pop--;
}
}
getch();
goto home;
break;
case 3:
if(isempty1()==true)
{
cout<<"Stack 1 kosong !";
}
else
{
cout<<"Data pada stack : ";
for(int i=0; i<=top1; i++)
{
cout<<nilai[i]<<" ";
}
for (int i=(top1+1); i<=(top2-1); i++)
{
cout<<" _ ";
}
}
if(isempty2()==true)
{
cout<<"Stack 2 kosong !";
}
else
{
for(int i=4; i>=top2; i--)
{
cout<<nilai[i]<<" ";
}
}
getch();
goto home;
break;
case 4:
top1=-1;
top2=5;
cout<<"Stack sudah kosong !";
getch();
goto home;
break;
}
getch();
}
struktur data
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
struct Mahasiswa
{
char Nim[100];
char Nama[100];
char Alamat[40];
short Umur;
};
main()
{
Mahasiswa Mhs;
cout<<"Nim : ";
cin.getline(Mhs.Nim,100);
cout<<"Nama : " <<endl;
cin.getline(Mhs.Nama,100);
cout<<"Alamat : "<<endl;
cin.getline(Mhs.Alamat,40);
cout<<"Umur : "<<endl;
cin>>Mhs.Umur;
cout<<"\n\n\nNim : "<<Mhs.Nim;
cout<<"\nNama : "<<Mhs.Nama;
cout<<"\nAlamat : "<<Mhs.Alamat;
cout<<"\nUmur : "<<Mhs.Umur;
getch();
}
struktur 5 animasi queue
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#define n 10
using namespace std;
void INSERT();
void DELETE();
void CETAKLAYAR();
void Inisialisasi();
void RESET();
int PIL,F,R;
char PILIHAN [1],HURUF;
char Q[n];
int main ()
{
Inisialisasi();
do
{
cout<<" ANIMASI QUEUE " <<endl;
cout<<"=============="<<endl;
cout<<"1. INSERT"<<endl;
cout<<"2. DELETE"<<endl;
cout<<"3. CETAK QUEUE"<<endl;
cout<<"4. QUIT"<<endl;
cout<<"PILIHAN : "; cin>>PILIHAN;
PIL=atoi(PILIHAN);
switch (PIL)
{
case 1:
INSERT ();
break;
case 2:
DELETE();
break;
case 3:
CETAKLAYAR ();
break;
default:
cout<<"TERIMA KASIH"<<endl;
break;
}
cout<<"press any key to continue"<<endl;
getch();
system("cls");
}
while (PIL<4);
}
void INSERT()
{
if(R<n-1)
{
cout<<endl<<"MASUKAN 1 HURUF : ";
cin>>HURUF;
Q[++R]=HURUF;
}
else
cout<<"Antrian Penuh"<<endl;
}
void CETAKLAYAR()
{
if(F<R+1)
{
for (int i=F;i<=R;i++)
cout<<"Q[“<<i<<“] = "<<Q[i]<<endl;
}
else
cout<<"Antrian Kosong"<<endl;
}
void DELETE()
{
if(F<=R+1)
{
HURUF=Q[F];
Q[F++]='?';
cout<<"Data yang diambil : "<<HURUF<<endl;
if(F==n)
RESET();
}
else
cout<<"Antrian Kosong"<<endl;
}
void Inisialisasi()
{
F=0;
R=-1;
}
void RESET()
{
F=0;
R=-1;
}
struktur 9
#include<stdio.h>
#include<conio.h>
#include<iostream.>
struct Mahasiswa
{
char Nim[9];
char Nama[25];
char Alamat[4];
int Umur;
};
main()
{
Mahasiswa Mhs[5];
int i;
for (i=0; i<5; i++)
{
cout<<"Nim : ";
cin>>Mhs[i].Nim;
cout<<"Nama : ";
cin>>Mhs[i].Nama;
cout<<"Alamat : ";
cin>>Mhs[i].Alamat;
cout<<"Umur : ";
cin>>Mhs[i].Umur;
}
for(i=0; i<5; i++)
{
cout<<"\n\nNIM : "<<Mhs[i].Nim;
cout<<"\nNama : "<<Mhs[i].Nama;
cout<<"\nAlamat : "<<Mhs[i].Alamat;
cout<<"\nUmur : "<<Mhs[i].Umur;
}
getch();
}
struktur 8
#include<stdio.h>
#include<conio.h>
#define MAX 50
#define true 1
#define false 0
char stack[MAX];
int top;
void init(void);
int full (void);
int empty (void);
char pop (void);
void clear (void);
void push (char info);
void baca (void);
main()
{
char pilih,elm;
printf("----Demo Operasi Single Stack PTIK Semester 2----\n");
init();
do
{
printf("operasi single stack:\n");
printf("[1] PUSH\n");
printf("[2] POP\n");
printf("[3] CLEAR\n");
printf("[4] BACA\n");
printf("[5] SELESAI...\n");
printf(" Pilihan : ");scanf("%s",&pilih);
switch(pilih)
{
case '1': printf("PUSH ");scanf("%s",&elm);push(elm);break;
case '2': elm=pop();printf("POP %c\n",elm);break;
case '3': clear();break;
case '4': baca();break;
case '5': break;
default : printf("Salah pilih...\n");
}
printf("\n");
}while(pilih!='5');
getche();
}
void init(void)
{
top=0;
}
void push(char info)
{
if(full()!=true)
{ top++;
stack[top]=info; }
else printf("Stack overflow...\n");
}
char pop(void)
{
char info;
if(empty()!=true)
{ info=stack[top];
top--;
return(info);
}
else printf("Stack underflow...\n");
}
void clear(void)
{
top=0;
}
int full(void)
{
if(top==MAX) return(true);
else return(false);
}
int empty(void)
{
if(top==0) return(true);
else return(false);
}
void baca(void)
{
int i;
printf("isi stack : ");
if(top>0)
{
for(i=1;i<=top;i++)
printf("%c ",stack[i]);
}
else printf("(kosong)");
printf("\n");
}
struktur 7
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
main()
{
struct
{
char nim[100];
char nama[100];
char nilai [100];
float mhs;
} mahasiswa;
cout<<"masukan NIM = ";
cin>>mahasiswa.nim;
cout<<"masukan Nama = ";
cin>>mahasiswa.nama;
cout<<"masukan Nilai Akhir = ";
cin>>mahasiswa.nilai;
cout<<"NIM = "<<mahasiswa.nim<<endl;
cout<<"Nama = "<<mahasiswa.nama<<endl;
cout<<"Nilai Akhir = "<<mahasiswa.nilai<<endl;
return 0;
}
struktur 6
#include<stdio >
#include<conio >
#include<iostream >
struct Mahasiswa
{
char Nim[9];
char Nama[25];
char Alamat[40];
short Umur;
};
main()
{
Mahasiswa Mhs;
cout<<"Nim : ";
cin.getline(Mhs.Nim,9);
cout<<"Nama : ";
cin.getline(Mhs.Nama,25);
cout<<"Alamat : ";
cin.getline(Mhs.Alamat,40);
cout<<"Umur : ";
cin>>Mhs.Umur;
cout<<"\n\n\nNim : "<<Mhs.Nim;
cout<<"\nNama : "<<Mhs.Nama;
cout<<"\nAlamat : "<<Mhs.Alamat;
cout<<"\nUmur : "<<Mhs.Umur;
getch();
}
struktur 4
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
main()
{
int i;
struct
{
int nim[100];
int nama[100];
int nilai[100];
float mhs;
} mhs[5];
for(i=1; i<=2; i++)
{
cout<<"masukan NIM = ";
cin>>mhs[i].nim;
cout<<"masukan Nama = ";
cin>>mhs[i].nama;
cout<<"masukan Nilai Akhir = ";
cin>>mhs[i].nilai;
}
cout<<endl;
cout<<"data Mahasiswa"<<endl;
for(i=1; i<=2; i++)
{
cout<<"Data Ke – "<<i<<endl;
cout<<"NIM = "<<mhs[i].nim<<endl;
cout<<"Nama = "<<mhs[i].nama<<endl;
cout<<"Nilai Akhir = "<<mhs[i].nilai<<endl;
cout<<endl;
}
return 0;
}
struktur 1
#include<stdio.h>
#include<iostream>
#include<conio.h>
using namespace std;
struct Tinggal {
char Jalan[40];
char Kota[15];
char Pos[5];
};
struct Tgl_Lahir {
int Tanggal;
int Bulan;
int Tahun;
};
struct Mahasiswa {
char Nim[9];
char Nama[25];
Tinggal Alamat;
Tgl_Lahir Lahir;
};
void main()
{
Mahasiswa Mhs[5];
int i;
for(i=0;i<3;i++)
{
cout<<"NIM : "; cin>>Mhs[i].Nim;
cout<<"Nama : "; cin>>Mhs[i].Nama;
cout<<"Alamat :\n";
cout<<"\tJalan : "; cin>>Mhs[i].Alamat.Jalan;
cout<<"\tKota : "; cin>>Mhs[i].Alamat.Kota;
cout<<"\tKode Pos : "; cin>>Mhs[i].Alamat.Pos;
cout<<"Tanggal Lahir :\n";
cout<<"\tTanggal : "; cin>>Mhs[i].Lahir.Tanggal;
cout<<"\tBulan : "; cin>>Mhs[i].Lahir.Bulan;
cout<<"\tTahun : "; cin>>Mhs[i].Lahir.Tahun;
}
cout<<"\n\nMencetak Kembali Nilai Anggota\n\n";
for(i=0;i<3;i++)
{
cout<<"\nNIM : "<<Mhs[i].Nim;
cout<<"\nNama : "<<Mhs[i].Nama;
cout<<"\nAlamat :\n";
cout<<"\n\tJalan : "<<Mhs[i].Alamat.Jalan;
cout<<"\n\tKota : "<<Mhs[i].Alamat.Kota;
cout<<"\n\tKode Pos : "<<Mhs[i].Alamat.Pos;
cout<<"\nTanggal Lahir : "<<Mhs[i].Lahir.Tanggal<<"-";
cout<<Mhs[i].Lahir.Bulan<<"-"<<Mhs[i].Lahir.Tahun;
}
getch();
}
program squential
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int i;
int n;
int cari,ketemu=0;
int A[100];
cout<<"NAMA : MUHAMAD HUSNI RAMADHAN"<<endl;
cout<<"NIM : 191011400011 "<<endl;
cout<<"KELAS:02TPLE002 "<<endl;
cout<<"------------------------------"<<endl;
cout<<"#PROGRAM SEARCHING SEQUENTIAL#\n";
cout<<"------------------------------"<<endl;
cout<<"input jumlah data : ";
cin>>n;
cout<<endl;
for (i=1;i<=n;i++)
{
cout<<"Masukan Data Ke-"<<i<<" : ";
cin>>A[i];
}
cout<<endl;
cout<<"Input Bilangan yang dicari : ";
cin>>cari;
cout<<"--------------------------"<<endl;
cout<<endl;
for(i=0;i<=n;i++)
{
if (A[i]==cari)
{
ketemu=1;
cout<<"Data Ditemukan Pada Indeks Ke-"<<i;
}
}
if (ketemu==0)
{
cout<<"Data tidak ditemukan";
}
getch();
}
selection sort
#include<iostream>
using namespace std;
main ()
{
int i,a, masuk,data[100],simpan;
printf("NAMA : MUHAMAD HUSNI RAMADHAN \n");
printf("NIM : 191011400011 \n");
printf("KELAS : 02 TPLE 002 \n");
cout<<"Masukkan Banyak Bilangan:";
cin>>masuk;
for(i=0;i<masuk;i++)
{
cin>>data[i];
}
for(i=0;i<masuk;i++)
for(a=i+1;a<masuk;a++)
{
if(data[i]>data[a])
{
simpan=data[i];
data[i]=data[a];
data[a]=simpan;
}
}
cout<<" \n";
cout<<"hasil pengurutan:";
for(i=0;i<masuk;i++)
{
cout<<data[i]<<" \t";
}
}
program structur
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
struct Mahasiswa
{
char Nim[9];
char Nama[25];
char Alamat[40];
short Umur;
};
main()
{
Mhs;
cout<<"Nim : " ;
cin.getline(Mhs.Nim,9);
cout<<"Nama : ";
cin.getline(Mhs.Nama,25);
cout<<"Alamat : ";
cin.getline(Mhs.Alamat,40);
cout<<"Umur : ";
cin>> Mhs.Umur;
cout<<"\n\n\nNIM : "<< Mhs.Nim;
cout<<"\n\n\nNama : "<< Mhs.Nama;
cout<<"\n\n\nAlamat : "<< Mhs.Alamat;
cout<<"\n\n\nUmur : "<< Mhs.Umur;
getch();
}
push dan pop
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#define n 10
using namespace std;
char P[]={'>',' ',' ',' ',' ',' '};
int S[n],mov[2],X,Y,pil=0;
int *top1,*top2,*dasar1,*dasar2,*helpI;
//utama
void awal(){
top1=&S[-1];
top2=&S[n];
dasar1=&S[-1];
dasar2=&S[n];
helpI=&S[-1];
}
void push1(int x){
top1=top1+1;
*top1=x;
}
void push2(int y){
top2=top2-1;
*top2=y;
}
void pop1(){
X=*top1;
*top1=0;
top1=top1-1;
}
void pop2(){
Y=*top2;
*top2=0;
top2=top2+1;
}
int BisaDiisi(int k){
if(top2-top1>k)
return 1;
else
return 0;
}
int BisaDiambil1(){
if(top1>dasar1)
return 1;
else
return 0;
}
int BisaDiambil2(){
if(top2<dasar2)
return 1;
else
return 0;
}
void tampil(){
cout<<"\n================ data menjadi ==================="<<endl;
while(helpI!=(dasar2-1)){
helpI++;
cout<<*helpI<<" ";
}
cout<<"\n======================================================"<<endl;
helpI=&S[-1];
}
//tambahan
void tampilMenu(){
system("cls");
cout<<"========================================================"<<endl;
cout<<"1. Push 1"<<endl;
cout<<"2. Push 2"<<endl;
cout<<"3. Pop 1"<<endl;
cout<<"4. Pop 2"<<endl;
cout<<"========================================================="<<endl;
cout<<"pilihan anda : ";cin>>pil;
}
main(){
awal();
do{
tampilMenu();
cout<<endl;
//cout<<"nilai pil = "<<pil<<endl;
switch(pil){
case 1: if(BisaDiisi(1)){
cout<<"masukkan bilangan = ";
cin>>X;
push1(X);
}
else{
cout<<"maaf tidak ada tempat untuk push";
}break;
case 2: if(BisaDiisi(1)){
cout<<"masukkan bilangan = ";
cin>>Y;
push2(Y);
}
else{
cout<<"maaf tidak ada tempat untuk push";
}break;
case 3: if(BisaDiambil1()){
pop1();
cout<<"data yang diambil = "<<X<<endl;
}
else{
cout<<"maaf stack 1 tidak ada isinya"<<endl;
}break;
case 4: if(BisaDiambil2()){
pop2();
cout<<"angka yang diambil = "<<Y<<endl;
}
else{
cout<<"maaf stack 2 tidak ada isinya"<<endl;
}break;
}
tampil();
cout<<"\nenter untuk mengulang dan esc untuk keluar !";
do{
mov[0]=getch();
if(mov[0]==27)
exit(0);
}while(mov[0]!=13);
}while(mov[0]==13);
getch();
}
pertemuan 5
#include<stdio.h>
#include<conio.h>
#include<iostream>
using namespace std;
struct Mahasiswa
{
char Nim[100];
char Nama[50];
char Alamat[40];
short Umur;
};
void Baca(Mahasiswa &Mhs);
void Cetak(Mahasiswa &Mhs);
main()
{
Mahasiswa Mhs;
cout<<"Membaca Nilai Anggota Struktur ";
Baca (Mhs);
cout<<"\nMencetak Nilai Anggota Struktur ";
Cetak(Mhs);
getch();
}
void Baca(Mahasiswa &Mhs)
{
cout<<"Nim : ";
cin.getline(Mhs.Nim,100);
cout<<"Nama : ";
cin.getline(Mhs.Nama,50);
cout<<"Alamat : ";
cin.getline(Mhs.Alamat,40);
cout<<"Umur : ";
cin>>Mhs.Umur;
}
void Cetak(Mahasiswa &Mhs)
{
cout<<"\nNIM : "<< Mhs.Nim;
cout<<"\nNama : "<< Mhs.Nama;
cout<<"\nAlamat : "<< Mhs.Alamat;
cout<<"\nUmur : "<< Mhs.Umur;
}
pertemuan 13
#include <iostream>
#include <conio.h>
using namespace std;
int binary_s(int array[], int size, int elemen);
int main()
{
int size=10;
int data[10]={18,17,16,11, 13, 14, 19, 15, 12 ,20} ;
cout<<"NAMA : MUHAMAD HUSNI RAMADHAN"<<endl;
cout<<"NIM : 191011400011 "<<endl;
cout<<"KELAS: 02TPLE002 "<<endl;
cout<<"Data Array"<<endl;
int i;
for(i=0;i<size;i++)
cout<<data[i]<<" ";
cout<<endl<<endl<<"masukkan data yang ingin anda cari: ";
int cari;
cin>>cari;
// pencarian
int hasil;
hasil = binary_s(data, size, cari);
if (hasil==0)
cout<<"Nilai ditemukan";
else
cout<<"Nilai tidak ditemukan";
getch();
}
int binary_s(int array[], int size, int elemen)
{
int awal = 0;
int akhir = size-1;
int nilaiTengah = (awal+akhir)/2;
while (nilaiTengah<=size && awal<=akhir)
{
nilaiTengah = (awal+akhir)/2;
if (array[nilaiTengah]==elemen)
return 1;
else if (elemen<array[nilaiTengah])
akhir = nilaiTengah-1;
else
awal = nilaiTengah+1;
}
return 0;
}
menghitung jumlah bilangan
#include <iostream>
#include <conio.h>
using namespace std;
int jumlah, desc;
main(){
cout<<"NAMA : MUHAMAD HUSNI RAMADHAN"<<endl;
cout<<"NIM : 191011400011 "<<endl;
cout<<"KELAS: 02TPLE002 "<<endl;
cout<<endl;
cout << "Masukan jumlah bilangan : ";
cin >> jumlah;
int nilai[jumlah];
for(int i=0; i<jumlah; i++){
cout << "Nomor " << (i+1) << " : ";
cin >> nilai[i];
}
for(int c=1;c<jumlah;c++)
{
for(int d=0;d<jumlah-c;d++)
{
if(nilai[d]<nilai[d+1])
{
desc=nilai[d];
nilai[d]=nilai[d+1];
nilai[d+1]=desc;
}
}
}
cout << endl << "Hasil Pengurutan Adalah";
for(int i=0;i<jumlah;i++)
{
cout << " " << nilai[i];
}
cout << endl;
getch();
return 0;
}
tugas akhir pertemuan 12
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<conio.h>
#include<stdio.h>
using namespace std;
struct Employee_str
{
char Name[25],status[15];
int anak,gaji;
char jmlh[2];
};
int main()
{
printf(" Nama : Muhammad husni \n");
printf(" ========================\n");
Employee_str employee[5];
int loop;
for(loop=1;loop<5;loop++)
{
cout<<"Karyawan (1, 2, 3, ..) : "<<endl;
cin.getline(employee[loop].jmlh,80.);
cout<<"Nama Karyawan "<<" : "<<endl;
cin.getline(employee[loop].Name,80.);
cout<<"Gaji/Bulan : "<<endl;
cin>>employee[loop].gaji;
cin.ignore(80);
cout<<"Status (Menikah/Belum Menikah) : "<<endl;
cin.getline(employee[loop].status,80.);
cout<<"Anak (0, / 1, 2, 3, ..) : "<<endl;
cin>>employee[loop].anak;
cin.ignore(80);
cout<<endl;
}
cout<<"Data Karyawan : "<<endl;
cout.flags(ios::left);
cout<<setw(0)<<"No "<<" Nama "<<" Gaji "<<" Status "<<" Anak"<<endl;
cout<<"================================================"<<endl;
for(loop=1;loop<5;loop++)
{
cout<<setiosflags(ios::left)<<setw(4)<<loop;
cout<<setiosflags(ios::left)<<setw(10)<<employee[loop].Name;
cout<<setiosflags(ios::left)<<setw(10)<<employee[loop].gaji;
cout<<setiosflags(ios::left)<<setw(20)<<employee[loop].status;
cout<<setiosflags(ios::left)<<setw(12)<<employee[loop].anak;
cout<<endl;
}
cout<<endl;
getch();
return 0;
}
menghitung jumlah mahasiswa
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
int a,b,c;
struct info{
int nomor;
int nim;
char nama[100];
char jeniskelamin[100];
char alamat[100];
};
struct info mahasiswa[30];
printf("NAMA : MUHAMAD HUSNI RAMADHAN \n");
printf("NIM : 191011400011 \n");
printf("KELAS : 02 TPLE 002 \n");
printf("Masukkan Jumlah Data Mahasiswa (Maks. 30 orang) : ");
scanf ("%d", &a);
for(b=0;b<a;b++)
{
mahasiswa[b].nomor=b+1;
printf("\n%d.\n", b+1);
printf("NIM : ");
scanf ("%d", &mahasiswa[b].nim);
printf("Nama : ");
scanf ("%s", &mahasiswa[b].nama);
printf("Jenis kelamin : ");
scanf ("%s", &mahasiswa[b].jeniskelamin);
printf("alamat : ");
scanf ("%s", &mahasiswa[b].alamat);
}
printf("\n%d Data Mahasiswa Telah Dimasukkan", b);
printf("\nNOMOR\t NIM\t Nama\t jenis kelamin\t alamat\n");
for (c=0;c<b;c++)
{
printf("\n %d\t %d\t %s\t %s\t %s\t\n",
mahasiswa[c].nomor,mahasiswa[c].nim,mahasiswa[c].nama,mahasiswa[c].jeniskelamin,mahasiswa[c].alamat);
}
system("pause");
return(0);
}
tugas pertemuan 11
#include <stdio.h>
// membuat struct
struct Mahasiswa {
char *name;
char *address;
int age;
};
int main(){
// menggunakan struct
struct Mahasiswa mhs1, mhs2;
// mengisi nilai ke struct
mhs1.name = "Dian";
mhs1.address = "Mataram";
mhs1.age = 22;
mhs2.name = "Bambang";
mhs2.address = "Surabaya";
mhs2.age = 23;
// mencetak isi struct
printf("## Mahasiswa 1 ##\n");
printf("Nama: %s\n", mhs1.name);
printf("Alamat: %s\n", mhs1.address);
printf("Umur: %d\n", mhs1.age);
printf("## Mahasiswa 2 ##\n");
printf("Nama: %s\n", mhs2.name);
printf("Alamat: %s\n", mhs2.address);
printf("Umur: %d\n", mhs2.age);
}
tugas pertemuan 10
#include <iostream>
#include <conio.h>
#include <stdio.h>
using namespace std;
main ()
{
int a,*Pa;
cout<<"NAMA :MUHAMAD HUSNI RAMADHAN "<<endl;
cout<<"NIM :191011400011 "<<endl;
cout<<"MATA KULIAH :ALGORITMA & PEMROGRAMAN"<<endl;
cout<<endl;
Pa=&a;
*Pa=200;
cout<<*Pa<<" ";
(*Pa)++;
cout<<*Pa<<" ";
(*Pa)--;
cout<<*Pa<<"\n";
getche();
}
Tugas akhir pertemuan 9
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>
int main ()
{
char nama1[20];
char nama2[20];
int i;
printf("============================\n");
printf("PROGRAM BY TRISNA AYU SILVIA\n");
printf("============================\n");
printf("Masukkan Nama Anda : ");
scanf("%s", nama1);
printf("Masukkan Nama hoby Anda : ");
scanf("%s", nama2);
strcat(nama1, " ");
strcat(nama1, nama2);
printf("\nhallo hobynya %s\n", nama1,nama2);
for(int i=0; i<strlen(nama1);i++){
if (nama1[i]==toupper(nama1[i])){
nama1[i]=tolower(nama1[i]);
}
else
{
nama1[i]=toupper(nama1[i]);
}
}
}
tugas pertemuan 8 array
#include <iostream>
using namespace std;
int main() {
int y[100];
int i, k;
cout<<" NAMA : MUHAMAD HUSNI RAMADHAN "<<endl;
cout<<" NIM : 191011400011 "<<endl;
cout<<" KELAS : 02 TPLE 002 REGULER C "<<endl;
cout<<" MATA KULIAH : Algoritma & Pemrograman 2 "<<endl<<endl;
for(i=0;i<10;i++){
k=i+1;
y[i]=k*k;
cout<<"pangkat dari "<<" "<< k <<"adalah"<<" "<<y[i]<<endl;
}
return 0;
}
//https://zoneblog123.blogspot.com/2018/04/5-contoh-program-array-beserta.html
Tugas pertemuan 8
#include <iostream>
#include <conio.h>
#include <string.h>
#include <stdio.h>
using namespace std;
main()
{
char asal[100];
char hasil[100];
cout<<"NAMA : MUHAMAD HUSNI RAMADHAN"<<endl;
cout<<"NIM : 191011400011"<<endl;
cout<<"Masukan kalimat : "; gets(asal);
strcpy(hasil,asal);
cout<<endl;
cout<<"Kalimat asal : "<<asal<<endl;
cout<<"Kalimat hasil : "<<hasil<<endl;
getch();
}
Tugas Pertemuan 10
#include <stdio.h>
#include <string.h>
int main() {
char kalimat[100];
int jumlah;
printf("NAMA :MUHAMAD HUSNI RAMADHAN\n");
printf("NIM : 191011400011\n");
printf("MATA KULIAH : ALGORITMA & PEMROGRAMAN\n");
printf("Masukkan sebuah string: " );
fgets(kalimat, sizeof(kalimat), stdin);
jumlah = strlen(kalimat)-1;
printf("Jumlah karakter adalah %d\n", jumlah);
return 0;
}
Tugas akhir pertemuan 6
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#define n 10
using namespace std;
void INSERT();
void DELETE();
void CETAKLAYAR();
void Inisialisasi();
void RESET();
int PIL,F,R;
char PILIHAN [1],HURUF;
char Q[n];
int main ()
{
Inisialisasi();
do
{
cout<<" ANIMASI QUEUE " <<endl;
cout<<"=============="<<endl;
cout<<"1. INSERT"<<endl;
cout<<"2. DELETE"<<endl;
cout<<"3. CETAK QUEUE"<<endl;
cout<<"4. QUIT"<<endl;
cout<<"PILIHAN : "; cin>>PILIHAN;
PIL=atoi(PILIHAN);
switch (PIL)
{
case 1:
INSERT ();
break;
case 2:
DELETE();
break;
case 3:
CETAKLAYAR ();
break;
default:
cout<<"TERIMA KASIH"<<endl;
break;
}
cout<<"press any key to continue"<<endl;
getch();
system("cls");
}
while (PIL<4);
}
void INSERT()
{
if(R<n-1)
{
cout<<endl<<"MASUKAN 1 HURUF : ";
cin>>HURUF;
Q[++R]=HURUF;
}
else
cout<<"Antrian Penuh"<<endl;
}
void CETAKLAYAR()
{
if(F<R+1)
{
for (int i=F;i<=R;i++)
cout<<"Q[“<<i<<“] = "<<Q[i]<<endl;
}
else
cout<<"Antrian Kosong"<<endl;
}
void DELETE()
{
if(F<=R+1)
{
HURUF=Q[F];
Q[F++]='?';
cout<<"Data yang diambil : "<<HURUF<<endl;
if(F==n)
RESET();
}
else
cout<<"Antrian Kosong"<<endl;
}
void Inisialisasi()
{
F=0;
R=-1;
}
void RESET()
{
F=0;
R=-1;
}
Tugas Akhir pertemuan 3
#include<stdio.h>
#include<iostream>
#include<conio.h>
using namespace std;
struct Tinggal
{
char Jalan[50];
char Kota[15];
char Kode_Pos[15];
};
struct Tanggal
{
int Tanggal;
int Bulan;
int Tahun;
};
struct Biodata
{
char Nip[9];
char Nama[25];
char Agama[10];
char Jabatan[10];
char Unit_kerja[15];
Tinggal Alamat;
Tanggal Lahir;
Tanggal Mulai_kerja;
};
main()
{
Biodata Pegawai[5];
int i;
cout<<"============================================="<<endl;
cout<<"Nama : MUHAMAD HUSNI RAMADHAN"<<endl;
cout<<"NIM : 191011400011"<<endl;
cout<<"Kelas :04TPLE002" <<endl;
cout<<"Mata Kuliah : Praktikum Struktur Data" <<endl;
cout<<"============================================="<<endl;
cout<<"TUGAS AKHIR PERTEMUAN 3"<<endl;
cout<<"Program Pendataan Karyawan"<<endl;
cout<<"============================================="<<endl;
cout<<"NIP : ";cin>>Pegawai[i].Nip;
cout<<"Nama : ";cin>>Pegawai[i].Nama;
cout<<"Alamat : ";cin>>Pegawai[i].Alamat.Jalan;
std :cin.getline(Jalan,50);
cout<<"Kota : ";cin>>Pegawai[i].Alamat.Kota;
cout<<"Kode Pos: ";cin>>Pegawai[i].Alamat.Kode_Pos;
cout<<"Jabatan : ";cin>>Pegawai[i].Jabatan;
cout<<"Agama : ";cin>>Pegawai[i].Agama;
cout<<"Tanggal Lahir ";
cout<<"Tanggal : ";cin>>Pegawai[i].Lahir.Tanggal;
cout<<"Bulan : ";cin>>Pegawai[i].Lahir.Bulan;
cout<<"Tahun : ";cin>>Pegawai[i].Lahir.Tahun;
cout<<"Tanggal Mulai Kerja ";
cout<<"Tanggal : ";cin>>Pegawai[i].Mulai_kerja.Tanggal;
cout<<"Bulan : ";cin>>Pegawai[i].Mulai_kerja.Bulan;
cout<<"Tahun : ";cin>>Pegawai[i].Mulai_kerja.Tahun;
cout<<"Unit Kerja : ";cin>>Pegawai[i].Unit_kerja;
cout<<"Cetak"<<endl;
cout<<"========================== NIP "<<Pegawai[i].Nip<<" ========================== ";
cout<<endl;
cout<<"Nama : "<<Pegawai[i].Nama<<endl;
cout<<"Alamat : "<<Pegawai[i].Alamat.Jalan<<""<<Pegawai[i].Alamat.Kota<<", "<<Pegawai[i].Alamat.Kode_Pos<<endl;
cout<<"Jabatan : "<<Pegawai[i].Jabatan<<endl;
cout<<"Agama : "<<Pegawai[i].Agama<<endl;
cout<<"Tgl Lahir : "<<Pegawai[i].Lahir.Tanggal<<"-"<<Pegawai[i].Lahir.Bulan<<"-"<<Pegawai[i].Lahir.Tahun<<endl;
cout<<"Tgl Mulai Krj : "<<Pegawai[i].Mulai_kerja.Tanggal<<"-"<<Pegawai[i].Mulai_kerja.Bulan<<"-"<<Pegawai[i].Mulai_kerja.Tahun<<endl;
cout<<"Unit Kerja : "<<Pegawai[i].Unit_kerja<<endl;
cout<<endl;
cout<<"==============================================================";
getch();
}
PROGRAM MENENTUKAN GRADE NILAI MAHASISWA
#include<iostream>
using namespace std;
main()
{
char nama[10],nim[10];
float nilai_1,nilai_2,nilai_3,total,rata;
cout<<"NAMA : TRISNA AYU SILVIA\n";
cout<<"KELAS : 01 TPLE 002\n";
cout<<"PRODI : TEKNIK INFORMATIKA\n";
cout<<"SEKOLAH TINGGI : UNIVERSITAS PAMULANG\n";
cout<<"==========================================\n";
cout<<"PROGRAM MENENTUKAN GRADE NILAI MAHASISWA\n";
cout<<endl;
cout<<"Masukkan Nama : ";cin>>nama;
cout<<"Masukkan Nim : ";cin>>nim;
cout<<endl;
cout<<"Masukkan Nilai Tugas : ";cin>>nilai_1;
cout<<"Masukkan Nilai UTS : ";cin>>nilai_2;
cout<<"Masukkan Nilai UAS : ";cin>>nilai_3;
cout<<"mata pelajraan :Kalkulus , Agama , Fisika"<<nama<<endl;
cout<<"==========================================\n";
total=nilai_1+nilai_2+nilai_3;
cout<<endl;
cout<<"Nama Mahasiswa : trisna ayu silvia"<<nama<<endl;
cout<<"Nim Mahasiswa : 191011400047"<<nim<<endl;
cout<<"Total Nilai : "<<total<<endl;
rata=total/3;
cout<<"Rata-Rata Nilai : "<<rata<<endl;
if(rata>=80 && rata<=100)
cout<<"Grade Nilai : A"<<endl;
if(rata>=71 && rata<=79)
cout<<"Grade Nilai : B+"<<endl;
if(rata>=65 && rata<=70)
cout<<"Grade Nilai : B"<<endl;
if(rata>=61 && rata<=64)
cout<<"Grade Nilai : C+"<<endl;
if(rata>=56 && rata<=60)
cout<<"Grade Nilai : C"<<endl;
if(rata>=40 && rata<=55)
cout<<"Grade Nilai : D"<<endl;
if(rata>=0 && rata<=39)
cout<<"Grade Nilai : E"<<endl;
}