ノマールファゾシオークリScaner classiヤナシュ
11349 ワード
#include <iostream>
#include <string.h>
using namespace std;
namespace qurilma
{
class skaner{
char kompaniyasi[100];
int ishlab_chiqarilgan_yili;
public:
char vazifasi[100];
int narxi;
int garantiyasi;
void kiritish()
{
cout << "Qaysi kompaniya tomonidan ishlab chiqarilganini kiriting : \n ";
cin >> kompaniyasi ;
cout << "Narxini kiriting : ";
cin >> narxi;
cout << "Yaratilgan yilini kiriting ";
cin >> ishlab_chiqarilgan_yili;
cout << " Qanday maqsadda foydalanilishi: ";
cin >> vazifasi;
cout << "Qancha muddatgacha ishlashiga kafolat berilgan : ";
cin >> garantiyasi;
}
void show()
{
cout << kompaniyasi << " tomonidan \n";
cout << ishlab_chiqarilgan_yili << "- yilda ishlab chiqarilgan \n";
cout << narxi << "$ turadi \n";
cout << vazifasi << " uchun foydalaniladi \n";
cout << garantiyasi << " - yilgacha ishlashiga kafolat beriladi \n";
}
friend void search ( skaner s[] , int n );
};
void search(skaner s[] , int n )
{
char kompaniya[100];
cout << "Kompaniya nomini kiriting :";
cin >> kompaniya;
bool bor = false ;
for(int i = 0 ; i < n ; i++)
{
if(strcmp(s[i].kompaniyasi,kompaniya) == 0)
{
s[i].show();
bor = true;
break;
}
}
if(bor == false )
{
cout << "Bu kompaniya skaner ishlab chiqarmaydi ";
}
}
}
using namespace qurilma ;
int main()
{
skaner obyekt[100];
int n;
cout << " Skanerlar soni - ";
cin >> n ;
for(int i = 0 ; i < n ; i++)
{
cout << i+1 <<" - skanerning ma'lumotlarini kiriting: \n";
obyekt[i].kiritish();
}
for(int i = 0 ; i < n-1 ; i++ )
{
for(int j = i+1 ; j < n; j++)
{
if(obyekt[i].narxi < obyekt[j].narxi)
{
swap(obyekt[i],obyekt[j]);
}
}
}
cout << "Narxi bo'yicha skanerlar ro'yxati :";
for(int i = 0 ; i < n ; i++)
{
obyekt[i].show();
}
search(obyekt,n);
system("Pause");
return 0;
}
Reference
この問題について(ノマールファゾシオークリScaner classiヤナシュ), 我々は、より多くの情報をここで見つけました https://dev.to/jamoliddin0710/nomlar-fazosi-orqali-scaner-classi-yaratish-23kkテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol