Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Dopisz konieczne naglowki oraz dyrektywe uzycia przestrzeni nazw JEST
- // W programie utworzono i zainicjalizowane tablice o nazwie tab. JEST
- // Prosze: utworzyc wektor o takim samym typie elementow jak tablica. JEST
- // Napisac klase lub strukture, ktora bedzie obiektem funkcyjnym
- // przyjmujacym jeden argument unsigned i zwracajacym jego podwojona wartosc.
- // Za pomoca algorytmu transform przebiec przez cala tablice tab,
- // uzywajac obiektu funkcyjnego wlozyc do wektora podwojone wartosci.
- // Nastepnie za pomoca algorytmu copy oraz iteratora strumienia
- // wyjsciowego output_iterator, wypisac zawartosc wektora na ekran.
- #include <iostream>
- #include <fstream>
- #include <functional>
- #include <algorithm>
- #include <list>
- #include <vector>
- #include <map>
- #include <iterator>
- #include <string>
- #include <cstring>
- using namespace std;
- class Object
- {
- public:
- unsigned int ret(unsigned int arg)
- {
- return arg * 2;
- }
- };
- int main() {
- array<unsigned int, 9> tab = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- vector<unsigned int> tab1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- Object o;
- transform(tab.begin().tab.end(), tab1.begin(), o.ret );
- ostream_iterator<unsigned int> out(cout, ", ");
- copy(tab1.begin(), tab1.end(), out);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement