Please help me to make some shorting program from this source code


int main() {
int menu;
int plat=-1,x,y;
int n;
buat();
n=1;
int pilih;
int namedit;
data customer[20];
char get[1];
bool ketemu;


if(menu == 3) {
system("cls");
plat++;

cout << "\n \tPENAMBAHAN DATA CUSTOMERS\n";
cout << " _______________________________________\n\n";
cout << " No Kendaraan\t\t\t\t: ";cin >> customer[plat].nomor; cin.getline(get,1);
cout << endl;
cout << " Nama Pemilik Kendaraan\t\t\t: "; cin.getline(customer[plat].nama,50);
cout << endl;
cout << " No.Tlp Pemilik Kendaraan\t\t: "; cin.getline(customer[plat].tlp,20);
cout << endl;
cout << " Alamat Pemilik Kendaraan\t\t: "; cin.getline(customer[plat].alamat,50);
cout << endl;
cout << " Merek Kendaraan\t\t\t: "; cin.getline(customer[plat].kelas.merek,20);
cout << endl;
cout << " Jenis Kendaraan (Matic/Bebek/Sport)\t: "; cin.getline(customer[plat].kelas.jenis,20);
cout << endl;
cout << " Tipe Kendaraan\t\t\t\t: "; cin.getline(customer[plat].kelas.tipe,20);
cout << endl;
cout << " Tahun Kendaraan (YYYY)\t\t\t: "; cin.getline(customer[plat].kelas.tahun,5);
cout << endl;
cout << " Tanggal Service (DD MM YYYY)\t\t: "; cin.getline(customer[plat].tanggal,15);
cout << endl;

cout << " _________________________________________________________________\n\n";
cout << " 1.Kembali ke Menu Utama\n\n";
cout << " 2.Keluar dari program\n";
cout << " _____________________________\n\n";
cout << " Masukan Pilihan Anda : "; cin >> pilih;
cout << endl;

if(pilih == 1) {
goto menuutama;
}
else if(pilih == 2) {
goto keluar;
}
}



Through this program I want to make a sorting, but can not. Someone can help me? Thanks
what do you want to sort, and what is the sort key/field/etc?
presumably, customer[] is to be sorted, but what is 'data' (type) ?



you can use standard sort on an array, or you can write your own if that is the goal.

your use of goto is not a good idea. Consider doing that a better way.

Last edited on
Topic archived. No new replies allowed.