+ Reply to Thread
Results 1 to 1 of 1

Thread: [C++]Matricea

  1. [C++]Matricea

    #1
    Moderator:
    Programare
    ~Wolf~'s Avatar
    Member since
    Jan 2017
    Location
    Dark abyss
    Posts
    3,095
    Last username
    GaBiTzU M@riju@n@ |Wolf| WarGods | Wolf
    Mentioned
    39 Post(s)
    Achievements Visitor Messages Given 1 Days Registered 3 Mentions Received 1 Mentions Given 2 Mentions Given 1 Visitor Messages Received 2 Visitor Messages Received 1 Total Posts 3
    Doneaza
    Sustine Comunitatea WarGods!
    Fii unul de-al nostru! Doneaza
    Doneaza in Cont Bancar
    Click aici pentru a face o Donatie

    [C++]Matricea

    Matrici


    Dupa mult timp revin cu un alt tutorial si anume cu matricile.

    Din tutorialele precedente, ati observat ca C++ ne permite stocarea a mai multe numere intr-o singura variabila si anume intr-un tablou unidimensional, sau cum il stim cu totii: vectorul.Tot C++ ne permite stocarea a acelorasi numere, dar intr-o forma mai organizata si mai extinsa.Ca sa intelegeti mai usor,
    o matrice poate fi considerata o lista de tablouri unidimensionale
    .

    Exemplu de matrici:
    Code:
    You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
    Code:
    You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
    Declararea matricilor e la fel de simpla ca declararea vectorilor.O matrice are 2 dimensiuni: un numar de linii si un numar de coloane.Astfel in primul exemplu avem 3 linii si 3 coloane, iar a 2-a 3 linii si 4 coloane.


    ATENTIE!
    *La fel ca la vector, parcurgerea matricilor
    SE INCEPE DE LA 0


    Declarare
    C++ Code:
    You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!


    unde
    -dimensiunea1 este numarul liniilor
    -dimensiunea2 este numarul coloanelor

    Deci, in exemplul 1 vom considera o matrice de numere naturale si o vom declara astfel:
    C++ Code:
    You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!


    -tipul variabilei: unsigned int(matrice de numere naturale)
    -numele variabilei(a matricii): a
    -numarul de linii: 3
    -numarul de coloane: 3
    Astfel observam ca
    Code:
    You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
    In al doilea exemplu vom avea urmatoarea declarare:
    C++ Code:
    You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!


    -avem 3 linii si 4 coloane
    Asadar:
    Code:
    You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!
    Acum ca am terminat partea de teorie si avem o idee despre ce inseamna o matrice, va voi invata sa cititi si sa afisati o matrice:
    C++ Code:
    You have to register to be able to see this link. Register HERE! If you are already a member please log in! If you still you are not able to see the link you need to activate your account or an administrator need to activate your account!


    Am ales 3 linii si 5 coloane,iar programul va arata asa:


    In urmatorul tutorial va voi invata despre diagonale si inca cateva lucruri.

    Sper ca ati inteles si ca v-am fost de ajutor.Pentru intrebari lasati reply va rog.Multumesc pentru atentie si spor la programat!
    Last edited by ~Wolf~; 05-12-2020 at 11:14 AM.
    Tutoriale C++: CLICK AICI
    Thanks ~Life~ a dat Thanks acetui post
    Like mugurhaiduc a dat Like acetui post

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Partners
Humble Monthly Bundle
Voucher PC-Garage