Televizion tenologiyalar


Download 0.53 Mb.
Sana02.01.2023
Hajmi0.53 Mb.
#1075612
Bog'liq
Zafar6








MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKEMT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

“TELEVIZION TENOLOGIYALAR” yo’nalishi
511_22 guruh talabasi
G’ANIYEV ZAFARBEKning
DASTURLASH Ifanidan tayyorlagan
6-Amaliy ishi
O’qituvchi: DAULETOV ADILBEK
Toshkent – 2022
3-VARIANT
1-TOPSHIRIQ:
3 Berilgan nomdagi matnli faylni yaratish va unga ixtiyoriy so’z kiritish dasturini tuzing. Uni palindromlikka tekshiring
Kod:
#include
#include
#include
using namespace std;
int main(){
char nomi[50]; string suz; bool a=1;
cout << "Fayl nomini kiriting: "; cin.getline(nomi,50);
cout << "So'zni kiriting: "; getline(cin,suz);
ofstream yoz(nomi);
yoz << suz;
yoz.close();
ifstream uqi(nomi);
getline(uqi,suz);
for(int i=0;iif(suz[i]!=suz[suz.length()-1-i]){
cout << "Palindrom emas!\n";
a=0;
break;
}
}
if(a){
cout << "Palindrom!\n";
}
}
Natija:

2-TOPSHIRIQ


3. Mijoz sinfini yarating. Unda kamida 5 ta maydon va ularni ekranga chiqaruvchi, qayta ishlovchi usullarni yarating.
Kod:
#include
using namespace std;
class Mijoz{
private:
string f_name,l_name,u_name;
int balans,tovar,l_tovar=0;
public:
Mijoz(){};
Mijoz(string f_name, string l_name,string u_name,int balans,int tovar){
this -> f_name = f_name;
this -> l_name = l_name;
this -> u_name = u_name;
this -> balans = balans;
this -> tovar = tovar;
}
void set_lTovar(int l_tovar){
this -> l_tovar = l_tovar;
balans = balans - l_tovar;
tovar = tovar + l_tovar;
}
void addbalans(int bnew){
balans+=bnew;
}
void set_name(string f_name, string l_name, string u_name){
this -> f_name = f_name;
this -> l_name = l_name;
this -> u_name = u_name;
}
void getAll(){
cout << "Mijozning ism familyasi: " << f_name << " " << l_name;
cout << "\nMijozning foydalnuvchi nomi: " << u_name;
cout << "\nMijoz balansi: " << balans;
cout << "\nMijozning umumiy tovar harajati: " << tovar << "\n\n";
}
};
int main(){
string arr[5][3] = {{"Akbar","Abdusattorov","falador4587"},{"Azamat","Habibullayev","_azuz_of"},{"Xushnud","Xomidov","nahotk1"},{"Abbos","Abdusattorov","coder_ooo"},{"Sherzod","Toshtemirov","Faladors"}};
Mijoz *mijozlar = new Mijoz[5];
for(int i=0;i<5;i++){
mijozlar[i] = Mijoz(arr[i][0],arr[i][1],arr[i][2],400,0);
}
for(int i=0;i<5;i++){
mijozlar[i].getAll();
}
mijozlar[0].set_lTovar(30);
mijozlar[0].addbalans(20);
mijozlar[0].getAll();
mijozlar[2].set_name("Vaxobov", "Muhammad Ali", "vakhobov04");
mijozlar[2].getAll();
}
Natija:

3-TOPSHIRIQ


3. Firmaning xodimlarining to’g’risida (familiya, ismi, ish haqi, jinsi) ma’lumot mavjud. Eng yuqori maosh oluvchi ayol haqida ma’lumotlarni chiqaring
Kod:
#include
#include
using namespace std;
class Firma{
private:
string name, familya, jinsi;
int maosh;
public:
Firma(){
};
Firma(string name, string familya, string jinsi, int maosh){
this -> name = name;
this -> familya = familya;
this -> maosh = maosh;
this -> jinsi = jinsi;
};
void set_All(int maosh){
this -> maosh = maosh;
}
void get_All(){
cout <<"Ismi -> "<cout <<"Familyasi -> "<cout <<"Maoshi -> "<cout <<"Jinsi -> "<};
};
int main(){
Firma *firma = new Firma[5]; int a[5];
for(int i=0; i<5; i++){
a[i] = rand()%2000+1000;
}
int k=0,max = a[0];
for(int i=1; i<5; i++){
if(max < a[i]){
max = a[i];
k=i;
}
}
string arr[5][4] = {{"Xushnud","Xomidov","450","erkak"},{"Nilufar","Abdurazzoqova","999","ayol"},{"Akbar","Abdusattarov","550","erkak"},{"Sanobar","Gafurova","100","ayol"},{"Asal","Yusupova","450","ayol"}};
for(int i=0; i<5; i++){
firma[i] = Firma(arr[i][0],arr[i][1],arr[i][3], a[i]);
}
for(int i=0; i<5; i++){
firma[i].get_All();
}
cout <cout <<"Eng ko'p maosh oladigon ayol hodim -> "<firma[k].get_All();
return 0;
}
Natija:

4-TOPSHIRIQ


3. Uchburchak sinfi yaratilsin va konstruktor e’lon qilinsin. Unda kamida uchta maydon va ularni ekranga chiqaruvchi va qayta ishlovchi sinf metodlarini yarating
Kod:
#include
#include
using namespace std;
class Uchburchak{
private:
float a,b,c,s=0,p=0;
string tur;
public:
Uchburchak(float a, float b, float c){
this->a = a;
this->b = b;
this->c = c;
};
void setYP(){
this ->p = (a+b+c);
this ->s = sqrt(p/2*(p/2-a)*(p/2-b)*(p/2-c));
}
void getYP(){
cout << "Uchburchak perimetri: " << p;
cout << " Uchburchak yuzi: " << s << endl;
}
void setType(){
if((c*c)==(a*a+b*b))
this -> tur = "To'g'ri";
else if((c*c)<(a*a+b*b))
this -> tur = "O'tkir";
else{
this -> tur = "O'tmas";
}
}
void getType(){
cout << "Uchburchakning turi: " << tur << " burchakli.\n";
}
void set_tomon(float a, float b, float c){
this->a = a;
this->b = b;
this->c = c;
}
void get_tomon(){
cout << a << " " << b << " " << c << endl;
}
};
int main(){
float a,b,c;
cout << "Uchburchakning tomonlarini kiriting(a,b,c): ";cin >> a >> b >> c;
Uchburchak obj = Uchburchak(a,b,c);
obj.setYP();
obj.setType();
obj.getYP();
obj.getType();
cout << "Yangi qiymatlarni kiriting: "; cin >> a>>b>>c;
obj.set_tomon(a,b,c);
cout << "Yangi qiymatlar uchun: \n";
obj.get_tomon();
obj.setYP();
obj.setType();
obj.getYP();
obj.getType();
Natija:




Download 0.53 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling