Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ContainerVector2
//g++ 7.4.0 //Container Vector: use of most of the vector member functions //this code is created by Rezaul Hoque on September 29,2021;contact:jewelmrh@yahoo.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #include <iostream> #include <vector> using namespace std; int main() { vector<int> a,b; vector<char> c,d,e; std::vector<char> f; //use of get_allocator char * p; p=f.get_allocator().allocate(12); for(unsigned int i=0;i<12;i++) std::cin>>p[i]; //use of assign() c.assign(38,'\\'); d.assign(38,'\/'); //use of push_back() e.push_back('\n'); e.push_back('V'); e.push_back('e'); e.push_back('c'); e.push_back('t'); e.push_back('o'); e.push_back('r'); //use of emplace() e.emplace(e.begin()+7,'\n');// use of e.begin() e.emplace(e.begin()+8,'S'); e.emplace(e.begin()+9,'e'); e.emplace(e.begin()+10,'p'); e.emplace(e.begin()+11,'t'); e.emplace(e.begin()+12,' '); //use of erase() e.erase(e.begin()+8,e.begin()+12); a.push_back(2); a.push_back(2); b.push_back(2); b.push_back(0); b.push_back(2); b.push_back(1); //use of clear() a.clear(); b.clear(); //use of rbegin() and rend() for(std::vector<char>::reverse_iterator rit=c.rbegin();rit!=c.rend();rit++){ cout<<*rit; } cout<<"\n"; for( unsigned int l=0;l<d.size();l++){ { cout<<d[l]; } } for(auto it=e.begin();it != e.end();it++) cout<<*it<<" "; for(unsigned int l=0;l<12;l++) std::cout<<p[l]; cout<<"\n"; //use of swap() c.swap(d); for(unsigned int l=0;l<c.size();l++){ cout<<c[l];} cout<<" \n"; for(unsigned int l=0;l<d.size();l++){ { cout<<d[l]; } } for(unsigned int l=0;l<12;l++) f.get_allocator().destroy(&p[l]); f.get_allocator().deallocate(p,12); return 0; }
run
|
edit
|
history
|
help
0
sdefrgthyjukiujyhtg
Hi
Preference List
Org
Different Subarray Sum Problem
template inhertinace
NWD
Exempel 4
A+B ორობით სისტემაში
typename T class T