13 Hamdamova Gulira’noxon 13
Download 53.41 Kb.
|
Guliran0 mustaqil ish
- Bu sahifa navigatsiya:
- 1 –topshiriq.
- 2 –topshiriq. 2 –jadvalning 2-ustunida berilgan masalani shartini bajaruvchi dastur tuzing.
- 3 –topshiriq. switch case tanlash operatoriga doir topshiriqlar
Mustaqil ish
1 –topshiriq. 1 –jadvalning 2-ustunida berilgan funksiyaning 4-ustunda berilgan kirish qiymatlardagiqiymatini hisoblash va natijani monitorga chop etuvchi dastur tuzing. if, if else operatorlariga doir topshiriqlar Dastur kodi : #include #include using namespace std; int main() { float x; cout<<"x= "; cin>>x; float Y; if (x>0) { Y = sin(2*x)*sin(2*x) - pow(cos(x),2); } else { Y = 1./(x*x-sqrt(x)); } cout<<"Natija : "< return 0; } Natijasi : 2 –topshiriq. 2 –jadvalning 2-ustunida berilgan masalani shartini bajaruvchi dastur tuzing. #include #include using namespace std; int main() { float x; cout<<"x= "; cin>>x; float Y = (exp(x)+exp(-x))/2.0; float Y1 = 1+abs(x); float Y2 = pow(1+x*x,x); cout<<"Tartiblanmagan xolati \n"< cout< else if (Y>= Y2 && Y2 >= Y1){ cout< else if (Y1>= Y && Y >= Y2){ cout< else if (Y1>= Y2 && Y2 >= Y){ cout< else if (Y2>= Y && Y >= Y1){ cout< else if (Y2>=Y1 && Y1 >= Y){ cout< return 0; } 3 –topshiriq. switch case tanlash operatoriga doir topshiriqlar switch case tanlash operatoridan foydalanib, o’zgaruvchilarning barcha qiymatlari uchun funkstiyani hisoblash dasturini tuzing. Case13. Teng yonli uchburchakning elementlari quyidagi tartibda nomerlangan: 1-katet a, 2-gipotenuza , 3-gipotenuzaga tushirilgan balandlik 4-yuzasi Shu elementlardan bittasi berilgan qolganlarini topuvchi dastur tuzilsin. #include #include using namespace std; int main() { float a; int n; cout<<"1. katet a\n2. gipatenuza\n3. balandlik\n4. Yuza\n"; cin>>n; switch (n){ case 1 :{ cout<<"Katetni kiriting : "; cin>>a; float c= sqrt(2)*a; cout<<"Gipatenuza : "< } case 2 :{ float c; cout<<"Gipatenuzani kiriting : "; cin>>c; float a= a/sqrt(2); cout<<"Katet : "<cout<<"Balandlik : "<< c/2< } case 3 : { float h; cout<<"Balandlik kiriting : "; cin>>h; float a= sqrt(2)*h; cout<<"Gipatenuza : "<<2*h< } case 4:{ float s; cout<<"Yuza kiriting : "; cin>>s; float c= sqrt(s)*2; cout<<"Gipatenuza : "< } } } Download 53.41 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling