#include #include using namespace std;
namespace online_shop
{
class Online_shop
{
char clothes[100];
public:
int price;
char firm[20];
void enter()
{
cout << "Kiyim nomi kiriting : ";
cin >> clothes;
cout << "Kiyim narxi : ";
cin >> price;
cout << "Firmasini kiriting : ";
cin >> firm;
}
void show()
{
cout << endl << "Kiyim nomi : " << clothes << endl;
cout << "Narxi : " << price << endl;
cout << "Kiyim firmasi : " << firm << endl;
}
friend void search(Online_shop shop[], int n);
};
void search(Online_shop shop[], int n)
{
char clothe[100];
cout << "\n1)Nom bo'yicha qidirish\n2)Firma bo'yicha qidirish\n->";
int a; cin >> a;
if (a == 1)
{
cout << "\nSearch...\nQidirilayotgan kiyimning nomini kiriting : ";
cin >> clothe;
bool info = false;
for (int i = 0; i < n; i++)
{
if (strcmp(shop[i].clothes, clothe) == 0)
{
shop[i].show();
info = true;
break;
}
}
if (info == false)
{
cout << "\nXato...\n";
}
}
else if (a == 2)
{
cout << "\nSearch...\nQidirilayotgan firmasini kiriting : ";
cin >> clothe;
bool info = false;
for (int i = 0; i < n; i++)
{
if (strcmp(shop[i].firm, clothe) == 0)
{
shop[i].show();
info = true;
break;
}
}
if (info == false)
{
cout << "\nXato ! \n";
}
}
}
void sort(Online_shop clothe[], int n)
{
cout << "\nSort...\nNarx bo'yicha saralash->\n";
{
for (int i = 0; i < n - 1; i++)
{
for (int j = i + 1; j < n; j++)
{
if (clothe[i].price < clothe[j].price)
{
swap(clothe[i], clothe[j]);
}
}
}
cout << "\nKiyimlarni narxi bo'yicha saralangan ro'yxat :\n";
for (int i = 0; i < n; i++)
{
clothe[i].show();
}
}
}
}
using namespace online_shop;
int main()
{
Online_shop clothes[20];
int n;
cout << "<-------------------------Online Shop ga Xush kelibsiz--------------------->\n";
cout << " Do'konimiz sizga turli qulayliklarni yaratib beradi. \n";
kiritish:
{
string username;
int aniqla,kod;
cout << "\nDo'konga tashrif buyurishingiz uchun foydalanuvchi turini tanlashingizni so'raymiz !!!\n";
cout << "\n Admin ---> 1 user--->2\n";
cout << "\nTanlovni amalga oshirishing : "; cin >> aniqla;