• 3- misol . ** tipidagi funksiyalar parametrlari
  • Понятие о динамических данных. Динамические массивы




    Download 78,3 Kb.
    bet6/6
    Sana18.05.2024
    Hajmi78,3 Kb.
    #241946
    1   2   3   4   5   6
    Bog'liq
    3-Mustaqil ishi 10

    cout<<"Kirish matritsasi\n";

    uchun (i=0;i

    {

    a[i]=(int*)malloc(m*sizeof(int));

    uchun (j=0;j

    cin>>a[i][j];//*(*(a+i)+j)

    }

    uchun (i=0;i

    uchun (j=0;j

    a[i][j]=2*a[i][j];

    cout<<"O'zgartirilgan matritsa:\n";

    uchun (i=0;i

    {for(j=0;j

    cout<

    cout<

    bepul(a[i]);

    }

    _getch();

    bepul(a);

    }


    #include
    #o'z ichiga
    void main()
    { int **a, n, m, i, j;
    cout<<"Kiritish n,m\n";
    cin>>n>>m;
    a=yangi int*[n];
    cout<<"Kirish matritsasi\n";
    uchun (i=0;i{ a[i]=yangi int[m ];
    uchun (j=0;jcin>>a[i][j];//*(*(a+i)+j)
    }
    uchun (i=0;iuchun (j=0;ja[i][j]=2*a[i][j];
    cout<<"O'zgartirilgan matritsa:\n";
    uchun (i=0;i{ for(j=0;jcout<cout<o'chirish [] (a[i]);
    }
    o'chirish [] a;
    _getch();
    }
    siz turli uzunlikdagi matritsa qatorlarini yasashingiz mumkin - m ni tsiklga kiritish

    3- misol . ** tipidagi funksiyalar parametrlari

    #include

    #o'z ichiga

    float sum(float **a, int n, int m);

    void main()

    { float **a; int n, m, i, j;

    cout<<"Kirish n,m"<

    cin>>n>>m;

    a=yangi float*[n];

    uchun (i=0;i

    { a[i]=yangi float[m];

    uchun (j=0;j

    cin>>a[i][j];

    }

    cout<<"sum="<

    _getch();

    uchun (i=0;i

    o'chirish [] a[i];

    o'chirish [] a;

    }


    float summasi(float **a, int n, int m)
    {
    float s; int i,j;
    s=0;
    uchun (i=0;iuchun(j=0;js=s+a[i][j];
    qaytish(lar);
    }
    Download 78,3 Kb.

    1   2   3   4   5   6




    Download 78,3 Kb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Понятие о динамических данных. Динамические массивы

    Download 78,3 Kb.