1 / 7

Implementasi Struct

Implementasi Struct. Ilustrasi Object. No_Mesin. No_pesan. Harga. Harga. Mobil. Pesan. dipesan. No_Rangka. Plat. Tglpesan. melakukan. Pemesan. No_ktp. Nama. alamat. struct mobil { char no_mesin [8], no_rangka [20], plat[10];float harga ; }; struct pemesan {

vartan
Download Presentation

Implementasi Struct

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ImplementasiStruct

  2. Ilustrasi Object No_Mesin No_pesan Harga Harga Mobil Pesan dipesan No_Rangka Plat Tglpesan melakukan Pemesan No_ktp Nama alamat

  3. structmobil{ char no_mesin[8],no_rangka[20], plat[10];float harga; }; structpemesan{ char no_ktp[16],nama[20],alamat[40]; } ; structtanggal{ char dd[2],mm[2],yyyy[4]; } ; structpesan{ char no_pesan[10]; float tharga; structtanggaltglPesan; structmobilmbl[3]; structpemesanpmsn; }; DeklarasiStruct

  4. //inisialisasi main struct structpesanpsn[5]; //proses input for(inti=0;i<5;i++){ cout<<“Masukkan data anda!\n”; cout<<“No Pesan : ”;cin>>psn[i].no_pesan; cout<<“Tanggal : ”;cin>>psn[i].tglpesan.dd>> psn[i].tglpesan.mm>> psn[i].tglpesan.yyyy; cout<<“Masukkan Data Pemesan\n”;//info masukkanPemesan cout<<“No KTP : ”;cin>>psn[i].pmsn.no_ktp; //……sampe data pemesanselesai, masukkan data mobil for(int j=0;j<3;j++){ cout<<“No Mesin : ”;cin>>psn[i].mbl[j].no_mesin; //……. Sampe data mobilselesai } } Proses coding

  5. //proses output for(inti=0;i<5;i++){ cout<<“No Pesan : ”<<psn[i].no_pesan<<endl; cout<<“Tanggal : ”<< psn[i].dd<<“-”<<psn[i].mm <<“-”<< psn[i].yyyy<<endl; cout<<“Data Pemesan\n”; cout<<“No KTP : ”<<psn[i].pmsn.no_ktp<<endl; //…….sampe data pemesanhabis, ke info memasukkanmobil cout<<“No Mesin \t No Rangka \t Plat \t Harga\n”; for(int j=0;j<3;j++){ cout<<psn[i].mbl[j].no_mesin<<“ \t ”<< psn[i].mbl[j].no_rangka<<“ \t ”<< psn[i].mbl[j].plat<<“ \t ”<< psn[i].mbl[j].harga<<“ \t ”<< } } Proses coding

  6. Kasusimplementasi No_Mesin Plat Tglpesan Harga No_pesan Harga Mobil Pesan dipesan No_ktp melakukan No_Rangka dikembalikan Pemesan dikembalikan No_kembali mengembalikan Pengembalian alamat Nama tglKmbl Harga

  7. Berdasarkan dari Kasus Implementasi di atas, buatlah program yang bertugas mengisi data dan menampilkan data Mahasiswa,KRS,KHS yang seperti contoh. Tugas

More Related