#include "stdafx.h"
#include #include #include using namespace std;
class kastum
{
public:
string name = "kastum";
string firma;
string material;
float razmer_eni;
float razmer_buyi;
int narx;
void show1()
{
cout << name << " " << firma << " " << material << " " << razmer_eni << "x" << razmer_buyi << " " << narx << endl;
}
friend void qidirish1(kastum z[100], int n, string nom);
friend void saralash1(kastum z[100], int n);
};
class shim
{
public:
string name = "shim";
string firmasi;
string materiali;
float razmeri_eni;
float razmeri_buyi;
int narxi;
void show2()
{
cout << name << " " << firmasi << " " << materiali << " " << razmeri_eni << "x" << razmeri_buyi << " " << narxi << endl;
}
friend void saralash2(shim z[100], int n);
friend void qidirish2(shim z[100], int n, string nom);
};
void qidirish1(kastum z[100], int n, string nom)
{
bool bor = false;
cout << "\nMahsulot nomi | firmasi | materiali | razmeri(sm) | narxi(sum) \n";
for (int i = 0; i < n; i++)
{
if (z[i].firma == nom)
{
bor = true;
z[i].show1();
}
if (!bor)
{
cout << "Bu firma kastumlari ro'yhatda yo'q\n\n";
}
}
}
void qidirish2(shim z[100], int n, string nom)
{
bool bor = false;
for (int i = 0; i < n; i++)
{
if (z[i].firmasi == nom)
{
bor = true;
z[i].show2();
}
if (!bor)
{
cout << "\nBu firma shimlari ro'yhatda yo'q\n";
}
}
}
void saralash1(kastum z[100], int n)
{
cout << "mahsulot nomi va firma nomi bo'yicha saralash: \n";
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (z[i].firma.compare(z[j].firma) < 0)
{
kastum temp = z[i];
z[i] = z[j];
z[j] = temp;
}
}
}
for (int i = 0; i < n; i++)
{
z[i].show1();
}
}
void saralash2(shim z[100], int n)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (z[i].firmasi.compare(z[j].firmasi) < 0)
{
shim temp = z[i];
z[i] = z[j];
z[j] = temp;
}
}
}
for (int i = 0; i < n; i++)
{
z[i].show2();
}
}
int main()
{
cout << "mahsulotlar sonini kirirtng: ";
int n;
cin >> n;
kastum a[n];
shim b[n];
for (int i = 0; i < n; i++)
{
cout << i + 1 << "-kastum firmasi nomini kiriting: ";
cin >> a[i].firma;
cout << i + 1 << "-kastum materiali nomini kiriting: ";
cin >> a[i].material;
cout << i + 1 << "-kastum razmerini kiriting(sm): (120 257) ";
cin >> a[i].razmer_eni;
cin >> a[i].razmer_buyi;
cout << i + 1 << "-kastum narxini kiriting: ";
cin >> a[i].narx;
}
cout << "\n_______________________________________________\n";
for (int i = 0; i < n; i++)
{
cout << i + 1 << "-shim firmasi nomini kiriting: ";
cin >> b[i].firmasi;
cout << i + 1 << "-shim materiali nomini kiriting: ";
cin >> b[i].materiali;
cout << i + 1 << "-shim razmerini kiriting(sm): (40 120) ";
cin >> b[i].razmeri_eni;
cin >> b[i].razmeri_buyi;
cout << i + 1 << "-shim narxini kiriting: ";
cin >> b[i].narxi;
}
cout << "\n____________________________________________________________\n";
cout << "\nMahsulot nomi | firmasi | materiali | razmeri(sm) | narxi(sum) \n";
for (int i = 0; i < n; i++)
{
a[i].show1();
b[i].show2();
}
cout << "\n____________________________________________________________\n";
cout << "qidirilayotgan mahsulotning firmasi nomini kiriting: ";
string nom;
cin >> nom;
qidirish1(a, n, nom);
qidirish2(b, n, nom);
saralash1(a, n);
saralash2(b, n);
system("pause");
return 0;
}#include "stdafx.h"
#include #include #include using namespace std;
class kastum
{
public:
string name = "kastum";
string firma;
string material;
float razmer_eni;
float razmer_buyi;
int narx;
void show1()
{
cout << name << " " << firma << " " << material << " " << razmer_eni << "x" << razmer_buyi << " " << narx << endl;
}
friend void qidirish1(kastum z[100], int n, string nom);
friend void saralash1(kastum z[100], int n);
};
class shim
{
public:
string name = "shim";
string firmasi;
string materiali;
float razmeri_eni;
float razmeri_buyi;
int narxi;
void show2()
{
cout << name << " " << firmasi << " " << materiali << " " << razmeri_eni << "x" << razmeri_buyi << " " << narxi << endl;
}
friend void saralash2(shim z[100], int n);
friend void qidirish2(shim z[100], int n, string nom);
};
void qidirish1(kastum z[100], int n, string nom)
{
bool bor = false;
cout << "\nMahsulot nomi | firmasi | materiali | razmeri(sm) | narxi(sum) \n";
for (int i = 0; i < n; i++)
{
if (z[i].firma == nom)
{
bor = true;
z[i].show1();
}
if (!bor)
{
cout << "Bu firma kastumlari ro'yhatda yo'q\n\n";
}
}
}
void qidirish2(shim z[100], int n, string nom)
{
bool bor = false;
for (int i = 0; i < n; i++)
{
if (z[i].firmasi == nom)
{
bor = true;
z[i].show2();
}
if (!bor)
{
cout << "\nBu firma shimlari ro'yhatda yo'q\n";
}
}
}
void saralash1(kastum z[100], int n)
{
cout << "mahsulot nomi va firma nomi bo'yicha saralash: \n";
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (z[i].firma.compare(z[j].firma) < 0)
{
kastum temp = z[i];
z[i] = z[j];
z[j] = temp;
}
}
}
for (int i = 0; i < n; i++)
{
z[i].show1();
}
}
void saralash2(shim z[100], int n)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if (z[i].firmasi.compare(z[j].firmasi) < 0)
{
shim temp = z[i];
z[i] = z[j];
z[j] = temp;
}
}
}
for (int i = 0; i < n; i++)
{
z[i].show2();
}
}
int main()
{
cout << "mahsulotlar sonini kirirtng: ";
int n;
cin >> n;
kastum a[n];
shim b[n];
for (int i = 0; i < n; i++)
{
cout << i + 1 << "-kastum firmasi nomini kiriting: ";
cin >> a[i].firma;
cout << i + 1 << "-kastum materiali nomini kiriting: ";
cin >> a[i].material;
cout << i + 1 << "-kastum razmerini kiriting(sm): (120 257) ";
cin >> a[i].razmer_eni;
cin >> a[i].razmer_buyi;
cout << i + 1 << "-kastum narxini kiriting: ";
cin >> a[i].narx;
}
cout << "\n_______________________________________________\n";
for (int i = 0; i < n; i++)
{
cout << i + 1 << "-shim firmasi nomini kiriting: ";
cin >> b[i].firmasi;
cout << i + 1 << "-shim materiali nomini kiriting: ";
cin >> b[i].materiali;
cout << i + 1 << "-shim razmerini kiriting(sm): (40 120) ";
cin >> b[i].razmeri_eni;
cin >> b[i].razmeri_buyi;
cout << i + 1 << "-shim narxini kiriting: ";
cin >> b[i].narxi;
}
cout << "\n____________________________________________________________\n";
cout << "\nMahsulot nomi | firmasi | materiali | razmeri(sm) | narxi(sum) \n";
for (int i = 0; i < n; i++)
{
a[i].show1();
b[i].show2();
}
cout << "\n____________________________________________________________\n";
cout << "qidirilayotgan mahsulotning firmasi nomini kiriting: ";
string nom;
cin >> nom;
qidirish1(a, n, nom);
qidirish2(b, n, nom);