Я хочу сделать код для hapus data playstation, но я не знаю, что это за коды?
#
include <iostream> #include <stdlib.h> #include <conio.h> using namespace std; struct data{ char jenis[20],nama[20],jumlah[20],menyewa[20],kembali[20],alamat[20],hp[20];}; data batas[100]; int a,b,c,d; void inputdataPS() { cout<<"\nJumlah Data Yang Akan diinput : ";cin>>b; d=0; for(c=0;c<b;c++){ d="d+1; " cout<<"\ndata="" ke-"<<d<<endl; ="" cout<<"jenis\t:="" ";cin="">>batas[a].jenis; cout<<"Jumlah\t: ";cin>>batas[a].jumlah; cout<<"Tanggal Menyewa\t: ";cin>>batas[a].menyewa; cout<<"Tanggal Mengembalikan\t: ";cin>>batas[a].kembali; a++;}} void inputdataPelanggan() { cout<<"\nJumlah Data Yang Akan diinput : ";cin>>b; d=0; for(c=0;c<b;c++){ d="d+1; " cout<<"\ndata="" ke-"<<d<<endl; ="" cout<<"nama\t:="" ";cin="">>batas[a].nama; cout<<"Alamat\t: ";cin>>batas[a].alamat; cout<<"No.HP\t: ";cin>>batas[a].hp; a++;}} void lihatdataPS() {int i,j; cout<<"\n================================Menampilkan Data===============================\n\n"; cout<<"===============================================================================\n"; cout<<"||\tNO\t||\tJenis\t||\tJumlah\t\t||\tTanggal Menyewa\t||\tTanggal Mengembalikan\t||\n"; j=0; for(i=0;i<a;i++) {j="j+1; " cout<<"="==============================================================================\n"; " cout<<"||\t"<<j<<"\t||"; ="" cout<<batas[i].jenis<<"\t||"; ="" cout<<batas[i].jumlah<<"\t\t\t||"; ="" cout<<batas[i].menyewa<<"\t\t||"; ="" cout<<batas[i].kembali<<"\t\t\t||";cout<<endl; ="" } ="" ";getch();system("cls");} void="" lihatdatapelanggan() {int="" i,j; ="" cout<<"\n="===============================Menampilkan" data="==============================\n\n"; " cout<<"||\tno\t||\tnama\t||\talamat\t\t||\tno.hp\t||\n"; ="" j="0; " for(i="0;i<a;i++) " cout<<batas[i].nama<<"\t||"; ="" cout<<batas[i].alamat<<"\t\t\t||"; ="" cout<<batas[i].hp<<"\t\t||";cout<<endl; ="" hapusdata() {int="" x,y; ="" cout<<"hapus="" ke-";cin="">>x; y=x-1; a--; for(int i=y;i<a;i++) {batas[i]="batas[i+1];} " system("cls"); ="" cout<<"\n\n\n\n\n\n\n\n\n="=============================" data="" ke-"<<x<<"="" terhapus="============================="; " getch();system("cls"); } void="" editdataps(){ int="" k,l; cout<<"masukan="" yang="" akan="" diedit="" :="" ";cin="">>k; l=k-1; cout<<"Jenis\t: ";cin>>batas[l].jenis; cout<<"Jumlah\t: ";cin>>batas[l].jumlah; cout<<"Tanggal Menyewa\t: ";cin>>batas[l].menyewa; cout<<"Tanggal Menggembalikan\t: ";cin>>batas[l].kembali; lihatdataPS(); } void editdataPelanggan(){ int k,l; cout<<"Masukan Data yang akan diedit : ";cin>>k; l=k-1; cout<<"Nama\t: ";cin>>batas[l].nama; cout<<"Alamat\t: ";cin>>batas[l].alamat; cout<<"No.HP\t: ";cin>>batas[l].hp; lihatdataPelanggan(); } int main() { int pilih; char w; cout<<"=================DATA SEWA PLAYSTATION=================\n\n\n\n\n\n"; cout<<" PROGRAM BY AZRIL BAGUS PRIYO NGGODHO \n"; cout<<" 2020 \n\n\n"; awal: cout<<"\n===================== PILIHAN MENU =====================\n"; cout<<"\n1. Masukkan data Playstation"; cout<<"\n2. Masukkan data Pelanggan"; cout<<"\n3. Hapus Data Playstation"; cout<<"\n4. Lihat Data Playstation"; cout<<"\n5. Lihat Data Pelanggan"; cout<<"\n6. Edit Data Playstation"; cout<<"\n7. Edit Data PeLanggan"; cout<<"\n8. Exit"; cout<<"\n\nMasukkan Pilihan : "; cin>>pilih; if(pilih==1) {system("cls");inputdataPS();goto awal;} if(pilih==2) {system("cls");inputdataPelanggan();goto awal;} if(pilih==3) {system("cls");hapusdata();goto awal;} if(pilih==4) {system("cls");lihatdataPS();goto awal;} if(pilih==5) {system("cls");lihatdataPelanggan();goto awal;} if(pilih==6) {system("cls");editdataPS();goto awal;} if(pilih==7) {system("cls");editdataPelanggan();goto awal;} if(pilih==8) {system("cls"); cout<<"\n\n\n\n\n\n\n\n APAKAH ANDA YAKIN KELUAR DARI PROGRAM??\n\n"; cout<<" [Y] [N] \n"<<endl; cout<<"="" ";cin="">>w; if(w=='y'||w=='Y') {system("cls"); cout<<"\n\n\n\n\n******************************* PROGRAM SELESAI *******************************";} if(w=='n'||w=='N') {system("cls");goto awal;}} else {system("cls");cout<<"Pilihan 1-5";getch();system("cls");goto awal;} cout<<"\n\n\n\n\n\n\n\n\n\t\t\t AZRIL BAGUS PRIYO NGGODHO\n\n"; cout<<"\t\t\t Bye_ _ _ _ _ _ "; }
Что я уже пробовал:
#include <iostream> #include <stdlib.h> #include <conio.h> using namespace std; struct data{ char jenis[20],nama[20],jumlah[20],menyewa[20],kembali[20],alamat[20],hp[20];}; data batas[100]; int a,b,c,d; void inputdataPS() { cout<<"\nJumlah Data Yang Akan diinput : ";cin>>b; d=0; for(c=0;c<b;c++){ d="d+1; " cout<<"\ndata="" ke-"<<d<<endl; ="" cout<<"jenis\t:="" ";cin="">>batas[a].jenis; cout<<"Jumlah\t: ";cin>>batas[a].jumlah; cout<<"Tanggal Menyewa\t: ";cin>>batas[a].menyewa; cout<<"Tanggal Mengembalikan\t: ";cin>>batas[a].kembali; a++;}} void inputdataPelanggan() { cout<<"\nJumlah Data Yang Akan diinput : ";cin>>b; d=0; for(c=0;c<b;c++){ d="d+1; " cout<<"\ndata="" ke-"<<d<<endl; ="" cout<<"nama\t:="" ";cin="">>batas[a].nama; cout<<"Alamat\t: ";cin>>batas[a].alamat; cout<<"No.HP\t: ";cin>>batas[a].hp; a++;}} void lihatdataPS() {int i,j; cout<<"\n================================Menampilkan Data===============================\n\n"; cout<<"===============================================================================\n"; cout<<"||\tNO\t||\tJenis\t||\tJumlah\t\t||\tTanggal Menyewa\t||\tTanggal Mengembalikan\t||\n"; j=0; for(i=0;i<a;i++) {j="j+1; " cout<<"="==============================================================================\n"; " cout<<"||\t"<<j<<"\t||"; ="" cout<<batas[i].jenis<<"\t||"; ="" cout<<batas[i].jumlah<<"\t\t\t||"; ="" cout<<batas[i].menyewa<<"\t\t||"; ="" cout<<batas[i].kembali<<"\t\t\t||";cout<<endl; ="" } ="" ";getch();system("cls");} void="" lihatdatapelanggan() {int="" i,j; ="" cout<<"\n="===============================Menampilkan" data="==============================\n\n"; " cout<<"||\tno\t||\tnama\t||\talamat\t\t||\tno.hp\t||\n"; ="" j="0; " for(i="0;i<a;i++) " cout<<batas[i].nama<<"\t||"; ="" cout<<batas[i].alamat<<"\t\t\t||"; ="" cout<<batas[i].hp<<"\t\t||";cout<<endl; ="" hapusdata() {int="" x,y; ="" cout<<"hapus="" ke-";cin="">>x; y=x-1; a--; for(int i=y;i<a;i++) {batas[i]="batas[i+1];} " system("cls"); ="" cout<<"\n\n\n\n\n\n\n\n\n="=============================" data="" ke-"<<x<<"="" terhapus="============================="; " getch();system("cls"); } void="" editdataps(){ int="" k,l; cout<<"masukan="" yang="" akan="" diedit="" :="" ";cin="">>k; l=k-1; cout<<"Jenis\t: ";cin>>batas[l].jenis; cout<<"Jumlah\t: ";cin>>batas[l].jumlah; cout<<"Tanggal Menyewa\t: ";cin>>batas[l].menyewa; cout<<"Tanggal Menggembalikan\t: ";cin>>batas[l].kembali; lihatdataPS(); } void editdataPelanggan(){ int k,l; cout<<"Masukan Data yang akan diedit : ";cin>>k; l=k-1; cout<<"Nama\t: ";cin>>batas[l].nama; cout<<"Alamat\t: ";cin>>batas[l].alamat; cout<<"No.HP\t: ";cin>>batas[l].hp; lihatdataPelanggan(); } int main() { int pilih; char w; cout<<"=================DATA SEWA PLAYSTATION=================\n\n\n\n\n\n"; cout<<" PROGRAM BY AZRIL BAGUS PRIYO NGGODHO \n"; cout<<" 2020 \n\n\n"; awal: cout<<"\n===================== PILIHAN MENU =====================\n"; cout<<"\n1. Masukkan data Playstation"; cout<<"\n2. Masukkan data Pelanggan"; cout<<"\n3. Hapus Data Playstation"; cout<<"\n4. Lihat Data Playstation"; cout<<"\n5. Lihat Data Pelanggan"; cout<<"\n6. Edit Data Playstation"; cout<<"\n7. Edit Data PeLanggan"; cout<<"\n8. Exit"; cout<<"\n\nMasukkan Pilihan : "; cin>>pilih; if(pilih==1) {system("cls");inputdataPS();goto awal;} if(pilih==2) {system("cls");inputdataPelanggan();goto awal;} if(pilih==3) {system("cls");hapusdata();goto awal;} if(pilih==4) {system("cls");lihatdataPS();goto awal;} if(pilih==5) {system("cls");lihatdataPelanggan();goto awal;} if(pilih==6) {system("cls");editdataPS();goto awal;} if(pilih==7) {system("cls");editdataPelanggan();goto awal;} if(pilih==8) {system("cls"); cout<<"\n\n\n\n\n\n\n\n APAKAH ANDA YAKIN KELUAR DARI PROGRAM??\n\n"; cout<<" [Y] [N] \n"<<endl; cout<<"="" ";cin="">>w; if(w=='y'||w=='Y') {system("cls"); cout<<"\n\n\n\n\n******************************* PROGRAM SELESAI *******************************";} if(w=='n'||w=='N') {system("cls");goto awal;}} else {system("cls");cout<<"Pilihan 1-5";getch();system("cls");goto awal;} cout<<"\n\n\n\n\n\n\n\n\n\t\t\t AZRIL BAGUS PRIYO NGGODHO\n\n"; cout<<"\t\t\t Bye_ _ _ _ _ _ "; }
Richard MacCutchan
Итак, во всем вышеприведенном коде у вас есть проблема?