Algoritmi cu vectori
NOTA!
-voi posta la fel ca in topicul "Algoritmi cu cifre"
Citirea si afisarea unui vector
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!
**NOTA!
-cand declarati un vector global toate elementele sale vor avea valoarea initiala 0
O alta metoda de declarare a vectorului pe care eu o prefer este urmatoarea:
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 declarat astfel cu scopul de a salva cat mai multa memorie, fiindca atunci cand se declara un vector de 10 elemente dar tu folosesti doar 5, celelalte 5 raman tot acolo in memorie.Cu metoda de mai sus declar un vector de atatea elemente cate am nevoie si de cate voi folosi.
Suma elementelor unui vector
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!