Qahramonova Baxmaloy
1. #include
#include
using namespace std;
class to_rtburchak{
public:
int x,y;
void k(int x1,int y1){x=x1; y=y1;}
xq(){return x;}
yq(){return y;}
};
int yuza(to_rtburchak *ob){
int s,t[2];
t[1]=sqrt(pow(ob[1].xq()-ob[2].xq(),2)+pow(ob[1].yq()-ob[2].yq(),2));
t[2]=sqrt(pow(ob[3].xq()-ob[2].xq(),2)+pow(ob[3].yq()-ob[2].yq(),2));
s=fabs(t[1])*fabs(t[2]);
return s;
}
int peri(to_rtburchak *ob){
int p,t[2];
t[1]=sqrt(pow(ob[1].xq()-ob[2].xq(),2)+pow(ob[1].yq()-ob[2].yq(),2));
t[2]=sqrt(pow(ob[3].xq()-ob[2].xq(),2)+pow(ob[3].yq()-ob[2].yq(),2));
p=2*(fabs(t[1])+fabs(t[2]));
return p;
}
int main()
{
to_rtburchak ob[5]; int x,y,n=64;
for(int i=1; i<=4; i++){
cout<cout<<"x["<>x;
cout<<" y["<>y;
ob[i].k(x,y);
}
cout<<"Yuza "<cout<<"Perimetr "<
return 0;
}
2. #include
#include
using namespace std;
class nuqta{
int x,y,x1,y1;
public:
q(int x3, int y3){
x=x3; y=y3;
}
q1(int x2, int y2){
x1=x2; y1=y2;
}
qx1(){return x;}
qx2(){return x1;}
qy1(){return y;}
qy2(){return y1;}
void l (nuqta nuqta1, nuqta nuqta2);
};
void nuqta::l(nuqta nuqta1, nuqta nuqta2){
float l1;
l1=sqrt(pow(nuqta1.qx1()-nuqta2.qx2(),2)+pow(nuqta1.qy1()-nuqta2.qy2(),2));
cout<<"Ikki nuqta orasidagi masofa "<}
int main()
{
nuqta nuqta1,nuqta2; int x,y,x1,y1;
cout<<"Nuqta1 x = "; cin>>x;
cout<<"Nuqta1 y = "; cin>>y;
cout<<"Nuqta2 x = "; cin>>x1;
cout<<"Nuqta2 y = "; cin>>y1;
nuqta1.q(x,y);
nuqta2.q1(x1,y1);
nuqta1.l(nuqta1,nuqta2);
return 0;
}
3. #include
#include
using namespace std;
class ratsional{
public:
int m,s;
kor(int s1, int m1){m=m1; s=s1;}
mq(){return m;}
sq(){return s;}
void info(ratsional ob);
};
void ratsional::info(ratsional ob){
int k,l,max,min,q;
k=ob.mq();
l=ob.sq();
if(fabs(l)>fabs(k)) cout<<"Noto'g'ri kasr \n"; else cout<<"To'g'ri kasr \n";
if((l>0&&k>0)||(l<0&&k<0)) cout<<"Musbat kasr \n"; else cout<<"Manfiy kasr \n";
if(k>l){
max=k; min=l;
} else {
max=l; min=k;
}
q=max%min;
while(q!=0){
max=min;
min=q;
q=max%min;
}
if(min==1||min==-1) cout<<"Qisqarmaydigan kasr \n";
else cout<<"Qisqaradigan kasr "<}
int main()
{
ratsional ob; int k,l;
cout<<"Kasrning surati "; cin>>l;
cout<<"Kasrning maxraji "; cin>>k;
ob.kor(l,k);
ob.info(ob);
return 0;
}
4. #include
using namespace std;
class Nuqta
{
int x;
int y;
public :
Get_x(){return x;}
Get_y(){return y;}
void Set_x(int _x);
void Set_y(int _y);
};
inline void Nuqta::Set_x(int _x) {x= _x;}
inline void Nuqta::Set_y(int _y) {y= _y;}
int main(){
Nuqta n1;
n1.Set_x(5); // inline funksiyaga murojat qilinganda, funksiya chaqirilgan joyga uning tanasi qo'yiladi: n1.x = 5;
n1.Set_y(6);
cout<<"x = "< cout<<"y = "<
}
5. #include
using namespace std;
class sanoq_s{
public:
int n;
void k(int n1){n=n1;}
nq(){return n;}
void ikki(sanoq_s ob);
void sakkiz(sanoq_s ob);
};
void sanoq_s::ikki(sanoq_s ob){
int q,b,i=0,g[100];
b=ob.nq(); cout<<"Ikkilik sanoq sistemasi \n"<while(b!=0){
i++;
q=b%2;
b=b/2;
g[i]=q;
}
for(int j=i; j>=1; j--){
cout<}
}
void sanoq_s::sakkiz(sanoq_s ob){
int q,b,i=0,g[100];
b=ob.nq(); cout<while(b!=0){
i++;
q=b%8;
b=b/8;
g[i]=q;
}
for(int j=i; j>=1; j--){
cout<}
}
int main()
{
sanoq_s ob;
cout<<"n = "; cin>>ob.n;
ob.ikki(ob);
ob.sakkiz(ob);
return 0;
}
6. #include
#include
using namespace std;
class uchburchak{
public:
float x,y;
void s (int x1, int y1){x=x1; y=y1;}
xq(){return x;}
yq(){return y;}
void turi(uchburchak *ob);
};
void uchburchak::turi(uchburchak *ob){
float a,b,c;
a=sqrt(pow(ob[1].xq()-ob[2].xq(),2)+pow(ob[1].yq()-ob[2].yq(),2));
b=sqrt(pow(ob[3].xq()-ob[2].xq(),2)+pow(ob[3].yq()-ob[2].yq(),2));
c=sqrt(pow(ob[1].xq()-ob[3].xq(),2)+pow(ob[1].yq()-ob[3].yq(),2));
if(a+b>c&&a+c>b&&b+c>a)
{ if(a==b||a==c||b==c) cout<<"Teng yonli uchburchak \n";
else if(a==b&&b==c) cout<<"Teng tomonli uchburchak \n";
else cout<<"Har xil tomonli uchburchak \n";
}
else cout<<"Bu nuqtalardan uchburchak hosil qilib bo'lmaydi \n";
}
class t_uchburchak : public uchburchak {
public:
float yuza(uchburchak *ob);
float peri(uchburchak *ob);
};
float t_uchburchak::yuza(uchburchak *ob){
float a,b,c;
a=(pow(ob[1].xq()-ob[2].xq(),2)+pow(ob[1].yq()-ob[2].yq(),2));
b=(pow(ob[3].xq()-ob[2].xq(),2)+pow(ob[3].yq()-ob[2].yq(),2));
c=(pow(ob[1].xq()-ob[3].xq(),2)+pow(ob[1].yq()-ob[3].yq(),2));
float s;
if(a==b&&b==c) s=sqrt(b*(a-b/4.0))/2;
else s=0;
return s;
}
float t_uchburchak::peri(uchburchak *ob){
float a,b,c;
a=sqrt(pow(ob[1].xq()-ob[2].xq(),2)+pow(ob[1].yq()-ob[2].yq(),2));
b=sqrt(pow(ob[3].xq()-ob[2].xq(),2)+pow(ob[3].yq()-ob[2].yq(),2));
c=sqrt(pow(ob[1].xq()-ob[3].xq(),2)+pow(ob[1].yq()-ob[3].yq(),2));
float p;
p=a+b+c;
return p;
}
int main()
{
uchburchak *ob,t; t_uchburchak p; float x,y; int n=3,k=64;
ob=new uchburchak[n];
for(int i=1; i<=3; i++){
cout<cout<<"x ["<>x;
cout<<" y ["<>y;
ob[i].s(x,y);
}
t.turi(ob);
cout<<"Yuza "<
cout<<"Perimetr "<
return 0;
}
Do'stlaringiz bilan baham: |