#include <iostream> using namespace std; struct product{ int product_id; string nama_product; string kategori; string satuan; float harga; string nama_perusahaan; }; int main() { product pd[100]; int jml_data,i; int cari; cin>>jml_data; for (i=0;i<jml_data;i++){ cin>>pd[i].product_id; cin.ignore(1000, '\n'); getline(cin,pd[i].nama_product,'\n'); getline(cin,pd[i].kategori,'\n'); getline(cin,pd[i].satuan,'\n'); cin>>pd[i].harga; cin.ignore(1000, '\n'); getline(cin,pd[i].nama_perusahaan,'\n'); } cout<<"Kode produk :"; cin>>cari; for (i=0;i<jml_data;i++){ if (pd[i].product_id==cari) { cout<<pd[i].product_id<<"\t"; cout<<pd[i].nama_product<<"\t"<<pd[i].kategori<<"\t"<<pd[i].satuan<<"\t"; cout<<pd[i].harga<<"\t"<<pd[i].nama_perusahaan<<endl; } } return 0; }