linkedin facebook linkedin facebook nod32

C++ da Begin bo`yicha misollar

Muallif: Mengliyev Sh.

Qo`shilgan sana: 2015-11-13

C++ da Begin bo`yicha misollar

Video darslik 

Begin1. Kvadratning tomoni a berilgan. Uning perimetri aniqlansin. P=4*a

#include<iostream.h>
int main()
{
float a,P;
cout<<"a"; cin>> a;
P:=4*a;
cout<<"P=" <<P;
system ("pause");
return 0;
}

Begin2. Kvadratningtomoni a berilgan. Uning yuzasi aniqiansin. S=a2

#include<iostream.h>
#include<math.h>
int main ()
{
int S,a;
cout<<"a="; cin>>a;
S=sqr(a);
cout<<"S=" <<S;
system ("Pause");
return 0;
}

Begin3. To'g'ri to'rtburchakning tomonlari a va b berilgan. Uning yuzasi S = a * b; va P = 2 * (a + b) perimetri aniqiansin.

#include<iostream.h>
#include<math.h>
int main()
{
 float a,b,s,p;
 cout<<"a=";cin>>a;
 cout<<"b=";cin>>b;
 s=a*b;
 p=2*(a+b);
 cout<<"s="<<s;
 cout<<"p="<<p;
 system("pause");
 return 0;
 }

Begin4. Aylananing diametri d berilgan. Uning uzunligi aniqiansin L=pi*d. pi = 3.14

#include<iostream.h>
#include<math.h>
int main()
{
 float L,d;
float const pi=3.14;
 cout<<"d=";cin>>d;
 L=pi*d;
 cout<<"L="<<L;
 cout<<"p="<<p;
 system("pause");
 return 0;
 }

Begin5. Kubning yon tomoni a berilgan. Uning hajmini V = a3  va to`la sirti S=6*a2 aniqiansin.

#include<iostream.h>
#include<math.h>
int main()
{
 int a,s,v;
 cout<<"a=";cin>>a;
 s=6*a*a;
 v=a*a*a;
 cout<<"s="<<s;
 cout<<"v="<<v;
 system("pause");
 return 0;
 }

Begin6. Paralelepepidning tomonlari a, b, с berilgan. Uning hajmini V = a*b*c  va to’la sirti S = 2*(a*b+b*c+a*c) aniqlansin.

#include<iostream.h>
#include<math.h>
int main()
{
 int a,b,c,s,v;
 cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"b=";cin>>b;
 v=a*b*c;
 s=2*(a*b+b*c+a*c);
 cout<<"s="<<s;
 cout<<"v="<<v;
 system("pause");
 return 0;
 }

Begin7. Doiraning radiusi R berilgan. Uning uzunligi L va yuzasi S aniqiansin. L = 2 pi R . S = pi *R2

#include<iostream.h>
#include<math.h>
int main()
{
 float L,S,R;
float const pi=3.14;
 cout<<"R=";cin>>R;
 L=2*pi*R;
S=pi*sqr(R);
 cout<<"L="<<L;
 cout<<"S="<<S;
 system("pause");
 return 0;
 }

Begin8. Ikkita son a va b berilgan. Ularning o’rta arifmetigi aniqiansin. Y=(a+b)/2

#include<iostream.h>
#include<math.h>
int main()
{
 float a,b,y;
 cout<<"a=";cin>>a;
 cout<<"b=";cin>>b;
  y=(a+b)/2;
 cout<<"y="<<y;
 system("pause");
 return 0;
 }

Begin9. Ikkita manfiy bo'Imagan son a va b berilgan. Ularning o'rta geometrigi aniqiansin. Y=sqrt(a*b)

#include<iostream.h>
#include<math.h>
int main()
{
 float a,b,y;
 cout<<"a=";cin>>a;
 cout<<"b=";cin>>b;
  y=sqrt(a*b);
 cout<<"y="<<y;
 system("pause");
 return 0;
 }

Begin10. Nolga teng bo'Imagan ikkita son berilgan. Ularning yig'indisini, ko’paytmasini va har birining kvadrati aniqiansin.

#include<iostream.h>
#include<math.h>
int main()
{
 float a,b,y,y1,y2;
 cout<<"a=";cin>>a;
 cout<<"b=";cin>>b;
y=a+b;
y1=a*b;
y2=sqr(a)+sqr(b);
 cout<<"y="<<y;
cout<<"y1="<<y1;
cout<<"y2="<<y2;
 system("pause");
 return 0;
 }

Begin11. Nolga teng bo'Imagan ikkita son berilgan. Ularning yig'indisini, ko’paytmasini va har birining moduli aniqiansin.

 #include<iostream.h>
#include<math.h>
int main()
{
 int a,b,s,v,d;
 cout<<"a=";cin>>a;
 cout<<"b=";cin>>b;
 s=a+b;
 v=a*b;
d=abs(a)
 cout<<"s="<<s;
 cout<<"v="<<v;
cout<<"d="<<d;
 system("pause");
 return 0;
 }

Begin12. To'gri uchburchakning katetlari a va b berilgan. Uning gipotenuzasi с va perimetri P aniqiansin. C=sqrt(sqr(a)+sqr(b)), P=a+b+c

#include<iostream.h>
#inceude<math.h>
int main()
{float a,b,c,p;
cout<<"a"; cin>> a;
cout<<"b"; cin>> b;
cout<<"c"; cin>> c;
p=a+b+c;
c:=sqrt(sqr(a)+sqr(b));
cout<<"p=" <<p;
cout<<"c=" <<c;
system ("pause");
return 0;
}

Begin13. Umumiy markazga ega bo'lgan ikkita aylana radiusi berilgan. R1,R2 (R1>R2).Ularnig yuzalari S1 va S2, ularning ayirmasi S3 aniqiansin. Sl =pi*R12,  S2=pi*R22,  S3 =pi(R12- R22).

#include<iostream.h>
#include<math.h>
int main()
{ int R1,R2,S1,S2,S3;
float const PI=3.14;
cout<<"R1="; cin>> R1;
cout<<"R2="; cin>> R2;
S1=PI*R1*R1;
S2=PI*R2*R2;
S3=PI*(R1*R1-R2*R2);
cout<<"S1="<<S1;
cout<<"S2="<<S2;
cout<<"S3="<<S3;
system("pause");
return 0;
}

Begin14. Aylananing uzunligi L berilgan. Uning radiusi R va yuzasi S aniqiansin L = 2* pi *R S = pi*R pi = 3.14
#include<iostream.h>
#include<math.h>
int main ()
{  float s,l,r;

 float const pi=3.14;

    cout<<"r=";cin>> r;

    l=2*p*r;
    s=p*r;

    cout<<"l="<<l;
    cout<<"s="<<s;
    system("pause");

    return 0;
}

Begin15. Aylananing yuzasi S berilgan. Uning diametri d va radiusi R aniqiansin L = 2*pi *R S = pi* R2 pi = 3.14
#include<iostream.h>
#include<math.h>
int main ()
{
int l,r,s;
float const pi=3.14;

cout<<"r="; cin>>r;
l=2*3*r;
s=3*r*r;
cout<<"s=" <<s;
cout<<"l=" <<l';
system ("Pause");
return 0;
}

Begin16. Sonlar o'qida ikkita nuqta orasidagi masofa aniqiansin. X3=|x1-x2|
#include<iostream.h>
#include<math.h>
int main()
{
 int x1,x2,x3;
cout<<"x1="; cin>> x1;
cout<<"x2="; cin>> x2;
x3=abs(x1-x2);
cout<<"x3="<<x3;
system("pause");
return 0;
}

Begin17. Sonlar o'qida А, В, С nuqtalar berilgan. С nuqta A va В nuqtalar orasida joylashgan. AC va BC kesmalar uzunligining ko'paytmasini toping.
#include<iostream.h>
#include<math.h>
int main()
{
 int ac,bc,p;
 cout<<"ac=";cin>>ac;
 cout<<"bc=";cin>>bc;
 p=ac*bc;
 cout<<"p="<<p;
 system("pause");
 return 0;
 }
Begin18. To'g'ri to'rtburchakning qarama-qarshi uchlari koordinatlari berilgan. Uning tomonlari koordinata o'qiga parallel. To'g'ri to'rtburchakning perimetri va yuzasi aniqiansin.
#include<iostream.h>
#include<math.h>
int main()
{
 int ab,ac,s,p;
 cout<<"ab=";cin>>ab;
  cout<<"ac=";cin>>ac;
 s=ac*ab;
 p=2*(ac+ab);
 cout<<"s="<<s;
 cout<<"p="<<p;
 system("pause");
 return 0;
 }
Begin19. Tekislikdagi berilgan ikki nuqta (x1,y1) va (x2,y2) orasidagi masofa topilsin.
#include<iostream.h>
#include<math.h>
int main ()
{
int x1,x2,y1,y2;
float d;
cout<<"x1="; cin>>x1;
cout<<"x2="; cin>>x2;
cout<<"y1="; cin>>y1;
cout<<"y2="; cin>>y2;
d=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
cout<<"d=" <<d;
system ("Pause");
return 0;
}

Begin20. x ning qiymati berilganda  y=4(x-3)6-7(x-3)3+2 funksiyaning qiymati aniqlansin.
include<iostream.h>
#include<math.h>
#include<iostream.h>
#include<math.h>
int main()
{
 int x,y;
cout<<"x="; cin>> x;
y=4*(x-3)*(x-3)*(x-3)*(x-3)*(x-3)*(x-3)-7*(x-3)*(x-3)*(x-3)+2;
cout<<"y="<<y;
system("pause");
return 0;

}
Begin21. A soni berilgan. A ning A2, A3, A4 , A5  darajalarini aniqlovchi programma tuzilsin.
#include<iostream.h>
#include<math.h>
int main ()
{
int a,y,y2,y3,y4;
cout<<"a="; cin>>a;
y=a*a;
y2=a*a*a;
y3=a*a*a*a;
y4=a*a*a*a*a;
cout<<"y=" <<y;
cout<<"y2=" <<y2;
cout<<"y3=" <<y3;
cout<<"y4=" <<y4;
system ("Pause");
return 0;
}
Begin22. Temperatura TC  gradus Selsiyda berilgan. Temperatura qiymatini TF Farengeytga o'tkazuvchi programma tuzilsin. TC=(TF-32)*5/9
include<iostream.h>
#include<math.h>
int main()
{
 int Tc,Tf;
cout<<"Tf="; cin>> Tf;
Tc=(Tf-32)*5/9;
cout<<"Tc="<<Tc;
system("pause");
return 0;
}
Begin23. Birinchi avtomabilning tezligi V1 km/soat  ikkinchisiniki V2 km/soat, ular orasidagi masofa S. Ular biri-biridan uzoqlasha boshlasa T vaqtdan keyin ular orasidagi masofani aniqlaydigan programma tuzilsin.
#include<iostream.h>
#include<math.h>
int main()
{
 int v1,v2,l,s,t;
 cout<<"t=";cin>>t;
 v1=20;
 v2=30;
 s=60;
 l=t*(v1+v2)+s;
 cout<<"l="<<l;
 system("pause");
 return 0;
 }
Begin24. A va В koeffisentlari berilgan, Ax+B =0 chiziqli tenglamaning yechimini (x ni) aniqlaydigan programma tuzilsin. A<>0
#include<iostream.h>
#include<math.h>
int main ()
{
int a,b,x;
cout<<"a="; cin>>a;
cout<<"b="; cin>>b;
x=-b/a;
cout<<"x=" <<x;
system ("Pause");
return 0;
}

4649 marta o`qildi.

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений