2 – amaliy mashg`ulot mavzu: С++ dasturlash tili va muhiti. Dastur strukturasi, elementlari. Alifbosi mashg’ulotining maqsadi


Download 356.83 Kb.
bet4/4
Sana08.11.2023
Hajmi356.83 Kb.
#1755102
1   2   3   4
Bog'liq
2 – amaliy mashg`ulot mavzu С dasturlash tili va muhiti. Dast

Arifmetik amalning yozilishi

С++ dasturlash tilida yozilishi

Arifmetik amalning yozilishi

С++ dasturlash tilida yozilishi

+

+

teng

==

-

-

teng emas

!=



*

kichik

<

:

/

katta

>

bo`lishdan qoldiq

%

kichik yo`ki teng

<=

inkrement

++

Katta yo`ki teng

>=

dekrement

--







C++ dasturlash tilida matematik funksiylarni yozishda quyidagi jadvaldan foydalaniladi:

Matematik funksiya

С++ dasturlash tilida yozilishi

Matematik funksiya

С++ dasturlash tilida yozilishi

х2

pow(x,2)

sinx

sin(x)

x

sqrt(x), pow(x,1/2.)

cosx

cos(x)

|x|

abs(x), fabs(x)

tg x

tan(x), sin(x)/cos(x)

ex

exp(x)

ctg x

1/tan(x), cos(x)/sin(x)



Pi

arcsin x

asin(x)

lnx

log(x)

arcos x

acos(x)

log2x

log(x)/log(2)

arctan x

atan(x)

lg(x)

loq10(x)

ax

pow(a,x)



pow(x,2/3.)







Dasturda matematik ifodaning qiymatini to`g`ri hisoblanishi uchun ifoda C++ dasturlash tilida yuqoridagi jadvaldan foydalanib yoziladi. Masalan:





Matematik ifoda

С++ dasturlash tilida yozilishi



y=(pow(x,2)-4*log(a))*(pow(c,2)/a);

y=|sin x|

y= abs (sin(x));

y=tg2x+7,5 ctg x3

y=pow(tan(x),2)+7.5*1/tan(pow(x,3);



y=(pow(log(x),2)+pow(1/tan(x),3))/
(log10(2)+exp(5*x));



O’zlashtirish uchun variant topshiriqlar:
C++ tilida ifodalarni yozing
Variant 1
1. 2.
3. 4.
5.

Variant 2


1. 2.
3. 4.
5.
Variant 3
1. 2.
3.
4.
5.

Variant 4


1. 2.
3.
4.
5.

Variant 5


1. 2.
3. 4.
5.

Variant 6


1. 2.
3.
4.
5.
Variant 7
1. 2.
3.
4.
5.
Variant 8
1. 2.
3. 4.
5.
Variant 9
1. 2.
3. 4.
5.

Variant 10


1. 2.
3. 4.
5.
Variant 11
1. 2.
3.
4.
5.

Variant 12


1.
2.
3.
4.
5.

Variant 13


1. 2.
3.
4.
5.
Variant 14
1. 2.
3.
4.
5.

Variant 15


1. 2.
3.
4.
5.

Variant 16


1. 2.
3.
4.
5.

Variant 17

1.
2.
3.
4.
5.

Variant 18


1. 2.
3.
4.
5.

Variant 19

1. 2.

3.

4.

5.


Variant 20

1. 2.
3.
4.
5.
Variant 21

1.


2.
3.
4.
5.

Variant 22



1. 2.
3.
4.
5.

Variant 23


1. 2.
3.
4.
5.
Variant 24

1. 2.


3.
4.
5.

Variant 25


1. 2.
3.
4.

5.

Variant 26

1. 2.


3.
4.
5.

Variant 27

1. 2.
3.
4.
5.

Variant 28

1. 2.

3.

4.
5.

Variant 29


1. 2.
3.
4.

5.


30 Variant

1.


2.
3.

4.



5.
Download 356.83 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




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