Oziq ovqat nomli namespaceda maydonlarni yaratish



Yüklə 331,94 Kb.
tarix20.04.2023
ölçüsü331,94 Kb.
#100970
oziq ovqat do\'koni


Oziq ovqat nomli namespaceda maydonlarni yaratish.

#include
#include
#include
using namespace std;
namespace OziqOvqat{
class Markaz
{
public:
char name[30];
int ochilgan_yil;
void show()
{
cout << setw(20) << name << "\t" << setw(20) << ochilgan_yil << endl;
}
};
class Joy:public Markaz
{
public:
int MaxSoni ;
int ishchiSon;
void input()
{
cout << "Oziq ovqat do'koning nomi:";cin>>name;
cout << "Markaz ochilgan yil:"; cin >> ochilgan_yil;
cout << "Masulotlar soni :"; cin >> MaxSoni;
cout << "Ishchilar soni:"; cin >> ishchiSon;
}
void show()
{
cout << setw(20) << name << "\t" << setw(20) << ishchiSon << setw(15) << ochilgan_yil << setw(15) << MaxSoni<< setw(15) << endl;
}
};
void search(Joy a[], int count, char name[])
{
bool check=false;
for(int i = 0; i < count; i++)
{
if(strcmp(a[i].name, name)==0)
{
a[i].show();
check=true;
}
}
if(check==false)
cout << "Bizning tumanda " << name << " nomli do'kon yo'q\n";
}}
using namespace OziqOvqat;
int main()
{
Joy ob[100], temp;
Markaz ob1[100];
char name[30];
int count;
cout << "Do'konlar sonini kiriting:";
cin >> count;
for(int i=0; icout << "\t\t" << i+1 << "-do'konni kiriting:" << endl;
ob[i].input();}
cout << "Qidirilayotgan do'kon nomini kiriting:";
cin >> name;
cout << setw(20) << "Name" << "\t" << setw(20) << "ishchiSon " << setw(15) << "ochilgan_yil" << setw(15) << "MaxSoni" << setw(20) << endl;
search(ob, count, name);
for(int i=0; ifor(int j=i+1; jif(ob[i].MaxSoni>ob[j].MaxSoni){
temp=ob[i];
ob[i]=ob[j];
ob[j]=temp;
}
}
}
cout << endl << endl;
cout << setw(20) << "Name" << "\t" << setw(20) << "ishchiSon" << setw(15) << "ochilgan_yil" << setw(15) << "MaxSoni" << setw(20) << endl;
for(int i=0; i < count; i++)
ob[i].show();
return 0;
}



Yüklə 331,94 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin