logo

Kompyuterning texnik va dasturiy ta’minot strukturasi, Algoritmlarni yozma(og`zaki) tasvirlash. Bloklar va blok-sxemalarni shakllantirish

Загружено в:

11.11.2024

Скачано:

0

Размер:

1179.8037109375 KB
O’ZBEKISTON RESPUBLIKASI 
OLIY VA O’RTA-MAXSUS TA’LIM VAZIRLIGI
SHAROF RASHIDOV NOMIDAGI  SAMARQAND DAVLAT
UNIVERSITETI
INTELLEKTUAL TIZIMLAR VA KOMPYUTER TEXNOLOGIYALARI
FAKULTETI
DASTURIY INJINIRING   YO’NALISHI
104 - guruh talabasi
SAYFULLAYEVA GULMIRA ning
DASTURLASH asoslari fanidan 
LABORATORIYA
ISHI
Tekshirdi: Eshonqulov E. 
SAMARQAND - 2023
PAGE   \* MERGEFORMAT2   ni chiqarish Tugatish 1-laboratoriya ishi . Kompyuterning texnik va dasturiy ta’minot strukturasi, Algoritmlarni
yozma(og`zaki) tasvirlash. Bloklar va blok-sxemalarni shakllantirish
1-LABORATORIYA MASHG’ULOTINI BAJARISH UCHUN NAMUNA
1. MASALANING QO’YILISHI.
1.1.  2ctg	(3x)−	lncosx
ln	⁡(1+x2) ifodaning qiymatini hisoblash algoritmini tuzing.
1.2.   Tomonlari  a, b, c,  bo’lgan uchburchakka uchburchakka ichki chizilgan
aylananing yuzasini topish algoritmini tuzing.   
2. AMALIY QISM
1.1-masala.
4.1) Qo’yilgan masala algoritmini blok-sxema ko’rinishida tasvirlash
PAGE   \* MERGEFORMAT2 x
N=2*ctg(3x)- ¿ ( cosx )
ln ⁡ ( 1 + x 2
)
NBoshlash
Tamom 1.2-masala
PAGE   \* MERGEFORMAT2a, b, c,  п= 3.14
S= п *(b+c−a)∗(a+c−b)∗(a+b−	c)	
4∗(a+b+c)
S Boshlash
Tamom 4-laboratoriya ishi. 
1. MASALANING QO’YILISHI.
ax 2
+bx+c=0 kvadrat tenglamani yechish algoritmini tuzing
2. AMALIY QISM
PAGE   \* MERGEFORMAT2 5 -laboratoriya mashg’uloti.
1. MASALANING QO’YILISHI
Mamlakatimizdagi milliy bayramlar ro’yxatini ekranga chop etadigan dasturini 
tuzing.
2. AMALIY QISM
Masalaning C++ dasturlash tilidagi dasturi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include <iostream>
using namespace std;
int main()
{
cout<<"O'zbekistonda milliy bayramlar:" << endl;
cout<<"1. 14-yanvar  \"Vatan himoyachilari kuni\""<<endl;
cout<<"2. 8-mart \"Xalqaro xotin-qizlar bayrami\""<<endl;
cout<<"3. 21-mart \"Navroz bayrami\"" << endl;
cout<<"4. 9-may  \"Xotira va qadrlash bayrami\"" << endl;
cout<<"5. 1-sentabr \"Mustaqillik bayrami\"";
return 0;
}
4.3) Natijani tekshirish – testlash
1-test:
Kiritilgan qiymat
Olingan natija
PAGE   \* MERGEFORMAT2 6 -laboratoriya mashg’uloti.
1. MASALANING QO’YILISHI
Tomonlari  a ,  b ,  c , bo’lgan uchburchakka uchburchakka ichki chizilgan
aylananing yuzasini topish dasturini tuzing.
4. AMALIY QISM
Masalaning C++ dasturlash tilidagi dasturi
1
2
3
4
5
6
7
8
9
10
11
12
13 #include <iostream>
using namespace std;
int main()
{
  float  const pi=3.14;
float a , b , c,S;
cin>>a>>b>>c;
S=pi*((b+c-a)*(a+c-b)*(a+b-c)/(4*(a+b+c)));
cout<<"S="<<S;
return 0;
}
4.3) Natijani tekshirish – testlash
1-test:
Kiritilgan qiymat a=3, b=3, c=5
Olingan natija
PAGE   \* MERGEFORMAT2 2-test:
Kiritilgan qiymat a= 1 , b= 1 , c=1
Olingan natija
7-laboratoriya ishi
1. MASALANING QO’YILISHI
Temperatura T F  gradus Selsiyda berilgan. Temperatura qiymatini T C 
Farangeytga o’tkazuvchi dastur tuzing. 
Ko’rsatma: T C  = (T F  – 32) ∙ 5/9
2. AMALIY QISM
Masalaning C++ dasturlash tilidagi dasturi
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include <iostream>
using namespace std;
int main()
{
  float Tf, Tc;
  cin>>Tf;
  Tc=(Tf-32)*5/9;
  cout<<"Tc="<<Tc;
return 0;
}
4.3) Natijani tekshirish – testlash
1-test:
PAGE   \* MERGEFORMAT2 Kiritilga
n qiymat Tf=41
Olingan 
natija
Kiritilga
n qiymat Tf=32
Olingan 
natija
PAGE   \* MERGEFORMAT2 Boshlash
  ni kiritish
T C  = (T F  – 32) ∙ 5/9
Tc ni chiqarish
Tugatish4.2  Algoritmni blok sxema usulida tasvirlash
PAGE   \* MERGEFORMAT2 8-laboratoriya ishi.
1. MASALANING QO’YILISHI
                    N	=	m2+2.8	m+0.355	
cos	(2y)+3.6 ifodani hisoblash dasturini tuzing. 
sturini tuzing.
4. AMALIY QISM
Masalaning C++ dasturlash tilidagi dasturi
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include <iostream>
#include <math.h>
using namespace std;
int main()
{
    float const pi=3.14;
    float m, y, N;
    cin>>m>>y;
    N=(pow(m,2)+2.8*m+0.355)/(cos(2*y*180/pi)+3.6);
    cout<<"N="<<N;
return 0;
}
4.3) Natijani tekshirish – testlash
1-test:
Kiritilgan 
qiymat m=3, y=2
Olingan 
natija
Kiritilgan 
qiymat m=5, y=1
PAGE   \* MERGEFORMAT2 Boshlash
  ni kiritish
N ni chiqarish
TugatishOlingan 
natija
4.2 Algoritmni blok-sxema usulida ifodalash
PAGE   \* MERGEFORMAT2 9-laboratoriya mashg’uloti. 
1. MASALANING QO’YILISHI
ax 2 +bx+c=0 kvadrat tenglamani yechish dasturini tuzing 
4. AMALIY QISM
Masalaning C++ dasturlash tilidagi dasturi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #include <iostream>
#include <math.h>
using namespace std;
int main()
{
    float a, b, c, D,x1, x2;
    cin>>a>>b>>c;
    D=pow(b,2)-4*a*c;
    if (D>0){
    x1=(-b+sqrt(D))/(2*a);
    x2=(-b-sqrt(D))/(2*a);
    cout<<"x1="<<x1<<endl;
    cout<<"x2="<<x2<<endl;
    }
    else if (D==0){
            x1=-b/(2*a);
    cout<<"x1="<<x1;
   }
    else if (D<0){
        cout<<"tenglamaning yechimi yo'q";
    }
return 0;
}
4.3) Natijani tekshirish – testlash
1-test:
Kiritilga
n qiymat a=1, b=5, c=4
Olingan 
natija
PAGE   \* MERGEFORMAT2 Kiritilga
n qiymat a=1, b=-5, c=4
Olingan 
natija
10-laboratoriya mashg’uloti.
1. MASALANING QO’YILISHI
Teng tomonli uchburchakning elementlari quyidagi tartibda nomerlangan. 1- 
tomoni a, 2-ichki chizilgan aylananing radiusi    R1=	a√3
6  ,   3- tashqi chizilgan 
aylananing radiusi R2=2R1,  ,4-yuzasi S= a 2
√ 3
4   shu elementlardan bittasi 
berilganda qolganlarini topuvchi programma tuzilsin.
4. AMALIY QISM
Masalaning C++ dasturlash tilidagi dasturi
1
2
3
4
5
6
7
8 #include <iostream>
#include <math.h>
using namespace std;
int main()
{
float a, R1, R2, S;
int n;
PAGE   \* MERGEFORMAT2 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 cout<<"n="; cin>>n;
switch (n){
case 1:
    {
        cin>>a;
        R1=(a*sqrt(3))/6;
        R2=(a*sqrt(3))/3;
        S=(pow(a,2)*sqrt(3))/4;
        cout<<"R1="<<R1<<endl<<"R2="<<R2<<endl<<"S="<<S;
    }
break;
case 2:
    {
        cin>>R1;
        a=(6*R1)/sqrt(3);
        R2=2*R1;
        S=3*sqrt(3)*pow(R1,2);
        cout<<"a="<<a<<endl<<"R2"<<R2<<endl<<"S="<<S;
    }
break;
case 3:
{
    cin>>R2;
    a=3*R2/sqrt(3);
    R1=R2/2;
    S=3*sqrt(3)*pow(R2,2)/4;
    cout<<"a="<<a<<endl<<"R1="<<R1<<endl<<"S="<<S;
}
break;
case 4:
{
    cin>>S;
    a=sqrt(4*S/sqrt(3));
    R1=2*sqrt(3*S)/(6*sqrt(sqrt(3)));
    R2=2*sqrt(3*S)/(3*sqrt(sqrt(3)));
    cout<<"R1="<<R1<<endl<<"R2="<<R2<<endl<<"a="<<a;
}
default : cout<<"noto'g'ri raqam kiritdingiz";
}
    return 0;
}
PAGE   \* MERGEFORMAT2 Natijani tekshirish – testlash
1-test:
Kiritilgan qiymat n=1, a=6
Olingan natija
11- LABORATORIYA MASHG’ULOTI
1. MASALANING QO’YILISHI
[2; n] intervalda bo’luvchilar yig’indisi eng katta bo’lgan natural sonni toping. 
4. AMALIY QISM
4.2) Masalaning C++ dasturlash tilidagi dasturi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <iostream>
using namespace std;
int main(){
int n, S=0, max=0, k;
cin>>n;
for(int i=2; i<=n; i++){
for(int j=1; j<=i; j++){
    if(i%j==0)
        S+=j;
}
if(max<S){
    max=S; k=i;
}
   S=0;
}
cout<<"Eng katta bo'luvchilar yig'indisiga ega bo'lgan son"<<k<<endl;
    return 0;
}
PAGE   \* MERGEFORMAT2 4.3) Natijani tekshirish – testlash
Kiritilgan qiymat n=10
Olingan natija
12-LABORATORIYA MASHG’ULOTI
1. MASALANING QO’YILISHI
Natural son berilgan. Undagi oxirgisiga teng bo’lgan raqam necha marta 
uchrashini aniqlang
4. AMALIY QISM
Masalaning C++ dasturlash tilidagi dasturi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include <iostream>
using namespace std;
int main(){
int n, a, k, S=0;
cin>>n;
a=n%10;
while(n!=0){
    k=n%10;
    if(k==a)
        S++;
    n=n/10;
}
cout<<S<<"ta";
    return 0;
}
4.3) Natijani tekshirish – testlash
1-test:
Kiritilgan qiymat n = 333
Olingan natija
PAGE   \* MERGEFORMAT2 13-14-  LABORATORIYA MASHG’ULOTI
1. Masalaning qo’yilishi.
{z
i  } , i= 1, … , 50 vektor berilgan . Bu vektorning uzunligini hisoblang:
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include <iostream>
#include <math.h>
using namespace std;
int main()
{
const int N=50;
int Z[N]; float S=0;
for (int i=0; i<N; i++)
    Z[i]=rand()%10;
for (int i=0; i<N; i++)
    S+=Z[i]*Z[i];
    cout<<sqrt(S);
return 0;
}
Natijani tekshirish – testlash :
1-test:
Olingan natija
PAGE   \* MERGEFORMAT2 15-LABORATORIYA MASHG’ULOTI.
1.Masalaning qo’yilishi
m x n o’lchamli matritsa berilgan. Massivning har xil ustunlari o’xshash deyiladi, 
agar ustunlardagi sonlar bir xil bo’lsa.  Oxirgi ustunga o’xshash bo’lgan ustunlar 
sonini aniqlovchi programma tuzilsin.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 
16
17
18
19
20
21
22
23
24
25
26
27
28 #include <iostream>
#include <math.h>
using namespace std;
int main()
{
    bool k=false;
    int const M=10;
    int const N=10;
    int n, m, S=0;
    cin>>n>>m;
    int B[M][N];
     for (int i=0; i<m; i++)
    for (int j=0; j<n; j++)
    B[i][j]=rand()%100;
    for (int i=0; i<M; i++)
        for (int j=0; j<N; j++)
    {
        if(B[m-1][j]==
            B[i][j] )
            k=true;
        else {k=false; break;}
    }
    if(k-=true)
        S++;
cout<<S<<"ta bir xil";
return 0;
PAGE   \* MERGEFORMAT2 29 }
Natijani tekshirish – testlash :
1-test:
Kiritilgan qiymat m=1 n=2
Olingan natija
PAGE   \* MERGEFORMAT2 PAGE   \* MERGEFORMAT2 PAGE   \* MERGEFORMAT2 PAGE   \* MERGEFORMAT2

O’ZBEKISTON RESPUBLIKASI OLIY VA O’RTA-MAXSUS TA’LIM VAZIRLIGI SHAROF RASHIDOV NOMIDAGI SAMARQAND DAVLAT UNIVERSITETI INTELLEKTUAL TIZIMLAR VA KOMPYUTER TEXNOLOGIYALARI FAKULTETI DASTURIY INJINIRING YO’NALISHI 104 - guruh talabasi SAYFULLAYEVA GULMIRA ning DASTURLASH asoslari fanidan LABORATORIYA ISHI Tekshirdi: Eshonqulov E. SAMARQAND - 2023 PAGE \* MERGEFORMAT2

ni chiqarish Tugatish 1-laboratoriya ishi . Kompyuterning texnik va dasturiy ta’minot strukturasi, Algoritmlarni yozma(og`zaki) tasvirlash. Bloklar va blok-sxemalarni shakllantirish 1-LABORATORIYA MASHG’ULOTINI BAJARISH UCHUN NAMUNA 1. MASALANING QO’YILISHI. 1.1. 2ctg (3x)− lncosx ln ⁡(1+x2) ifodaning qiymatini hisoblash algoritmini tuzing. 1.2. Tomonlari a, b, c, bo’lgan uchburchakka uchburchakka ichki chizilgan aylananing yuzasini topish algoritmini tuzing. 2. AMALIY QISM 1.1-masala. 4.1) Qo’yilgan masala algoritmini blok-sxema ko’rinishida tasvirlash PAGE \* MERGEFORMAT2 x N=2*ctg(3x)- ¿ ( cosx ) ln ⁡ ( 1 + x 2 ) NBoshlash Tamom

1.2-masala PAGE \* MERGEFORMAT2a, b, c, п= 3.14 S= п *(b+c−a)∗(a+c−b)∗(a+b− c) 4∗(a+b+c) S Boshlash Tamom

4-laboratoriya ishi. 1. MASALANING QO’YILISHI. ax 2 +bx+c=0 kvadrat tenglamani yechish algoritmini tuzing 2. AMALIY QISM PAGE \* MERGEFORMAT2

5 -laboratoriya mashg’uloti. 1. MASALANING QO’YILISHI Mamlakatimizdagi milliy bayramlar ro’yxatini ekranga chop etadigan dasturini tuzing. 2. AMALIY QISM Masalaning C++ dasturlash tilidagi dasturi 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include <iostream> using namespace std; int main() { cout<<"O'zbekistonda milliy bayramlar:" << endl; cout<<"1. 14-yanvar \"Vatan himoyachilari kuni\""<<endl; cout<<"2. 8-mart \"Xalqaro xotin-qizlar bayrami\""<<endl; cout<<"3. 21-mart \"Navroz bayrami\"" << endl; cout<<"4. 9-may \"Xotira va qadrlash bayrami\"" << endl; cout<<"5. 1-sentabr \"Mustaqillik bayrami\""; return 0; } 4.3) Natijani tekshirish – testlash 1-test: Kiritilgan qiymat Olingan natija PAGE \* MERGEFORMAT2