1 – laboratoriya ish topshiriq variantlari


Download 0.93 Mb.
Sana30.04.2023
Hajmi0.93 Mb.
#1412915
Bog'liq
1-Lobaratoriya Zayniddinov dasturlash(lb)


MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

431-21-guruh talabasi Zayniddinov Najmiddinning dasturlash lobaratoriya Chiziqli va tarmoqlanuvchi operatorlariga doir masalalar

Tekshirdi:_______________

Tekshirdi:_______________



1 – LABORATORIYA ISH TOPSHIRIQ VARIANTLARI


1 - topshiriq



  1. 1 –jadvalda berilgan ifodalarning qiymatini hisoblash uchun C++ dasturlash tilida dastur kodini yozing. Excel yordamida tekshiruvni bajaring:



Bajarilishi:



#include
#include
using namespace std;

int main() {


float a = 2.09, Y;
float pi = atan(1)*4;
Y = 2*sqrt(2*cos(a)*sin((pi/4)+2*a));
cout <<"Y ning qiymati= " <}
2- topshiriq

2 –jadvalda berilgan ifodalarning qiymatini hisoblash uchun C++ dasturlash tilida dastur kodini yozing. Excel yordamida tekshiruvni bajaring


Bajarilishi:



int main(){
float x = 0.1476;
float y = 3.56;
float z = 1.25/1000;
float Y = 772.025;

Y = 5*atan(x) -1/4*acos(x)*((x+3*abs(x-y)+pow(x,2))/(abs(x-y)*z+pow(x,2)));

cout << "Y ning qiymati=" <}
3 - topshiriq


if, if else operatorlariga doir topshiriqlar

Bajarilishi:



Int main(){
float x, z, y;
cout <<"x ga qiymat kriting \n "; cin>>x;
cout <<"z ga qiymat kriting \n";cin>>z;
if (abs(x) < 5*z){
y = log(abs( 2*x - 3*pow(z,2)));
} else if (abs(x) > 5*z){
y = log(abs(2*pow(x,2) - 3*z));
} else {
cout<<"error";
} cout << fixed;
cout.precision(3);
cout << y;
}


5 - topshiriq


switch case tanlash operatoriga doir topshiriqlar
switch case tanlash operatoridan foydalanib, o’zgaruvchilarning barcha qiymatlari uchun funkstiyani hisoblash dasturini tuzing.

Case17. O’quv masalalarini raqamini aniqlovchi 10-50 gacha butun son berilgan. Son kirirtilganda masala raqamini unga mos so’zlarda ifodalovchi dastur tuzilsin. (“yigirmanchi masala”, “o’ttiz beshinchi masala” va hk)

Bajarilishi:



#include


#include
using namespace std;
int main(){
int a, b, n;
cout<<"50 gacha masalalar bor \n";cin >>n;
a = n % 10;b = n / 10;
switch (b){
case 1: cout<<"o'n "; break;
case 2: cout<<"yigirma "; break;
case 3: cout<<"o'ttiz "; break;
case 4: cout<<"qriq "; break;
case 5: cout<<"ellik "; break;

default: break;
}
switch (a){
case 1: cout<<"birinchi masala"; break;
case 2: cout<<"ikkinchi masala"; break;
case 3: cout<<"uchinchi masala"; break;
case 4: cout<<"to'rtinchi masala"; break;
case 5: cout<<"beshinchi masala"; break;
case 6: cout<<"oltinchi masala"; break;
case 7: cout<<"yettinchi masala"; break;
case 8: cout<<"sakkizinchi masala"; break;
case 9: cout<<"toqqizinchi masala"; break;

default: break;
}

}

Download 0.93 Mb.

Do'stlaringiz bilan baham:




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