#include #include #include #include #include using namespace std ; int main(){ // zapelnienie wektora vector wektor={1,2,3,4}; cout<<"Metoda 1:" << endl; // uzycie iteratorow wskazujacych na poczatek i koniec wektora for (vector::iterator it = wektor.begin(); it != wektor.end(); ++it) { cout << *it << endl; (*it)++; } cout<<"Metoda 2:" << endl; // uzycie opcji auto do okreslenia typu iteratora for (auto it = wektor.begin(); it != wektor.end(); ++it) { cout << *it << endl; (*it)++; } cout<<"Metoda 3:" << endl; //uzycie petli zakresowej bez referencji (mozliwosc wypisu ale nie mozna zmienic) for (auto element : wektor) { cout << element << endl; element++; //komenda nie zmienia wartosci w wektorze } cout<<"Metoda 4:" << endl; //uzycie petli zakresowej z referencja (mozliwosc wypisu i zmiany) for (auto & element : wektor) { cout << element << endl; element++; } cout<<"Metoda 5:" << endl; //uzycie petli zakresowej z referencja const (mozliwosc wypisu ale brak mozliwosci zmiany) for (const auto & element : wektor) { cout << element << endl; // element++; <- powoduje blad kompilacji } cout<<"Metoda 6:" << endl; for (int it = 0; it