C++ da ASSIGMENT OPERATORI haqida ma'lumot.
feyyame1
Posted on December 23, 2022
biz c++ da bugungi darsimiz ASSIGMENT OPERATOR ni o'rgandik.
biz int ishorasi bilan 1 ta son belgilab, uni keyinchali o'zgartirsak ham bo'ladi.
unga misol:
int a = 10;
string ism = "rahima";
cout << a << endl;
cout << ism << endl;
a = 20;
ism = "kimsan";
cout << a << endl;
cout << ism;
}
biz int bilan ishlaganda -+ ni +- ; /* ni */ ga o'zgatirsak ham bo'ladi .
int a = 5;
int b = 6;
b = b+ a; // b +=a;
a = a- 10; // a -=10;
b*=3; // b = b * 3;
a /= b; // a = a / b;
cout << b;
}
masala uchun: biz doiraning yuzini olsak,
Doiraning uzunligi sifatida bittakasr-sonNni o'qiymiz. Shu doirani yuzini topib va natijani nuqtadan keyin 0 ta aniqlikda chop etamiz.
Ī ning qiymati:3.14
Raduisi r bo'lgan doiraning uzunligi: L = 2Īr bizda r no'malum sonni topishimiz kerak.
Doiraning yuzi formulasi: S = Īr^2
MASALANI javobi:
int main 2() {
double L;
cin >> L;
float PI = 3.14;
float r = L/(2*PI);
float S= PI * (r * r);
cout << round(S);
return 0;
}
biz bugun assigment operatori haqida ilk malumotni egalladik.
bunda birinchi navbatda int a da a ni yani biron sonni oqib olishimiz zarur.
int a = 10;
string ism = "rahima";
va biron bir soz kiritishimiz kerak.
biz int a da yozgan sonimiz va harifimiz masalan son bo'ladigon bo'lsa, (10) buni biz osha qismda 1 marta ishlatsak bo'ladi!!!
Posted on December 23, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.