Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Vector Example
//Vector Implementation //g++ 4.8.2 #include <iostream> #include <vector> #include <algorithm> using std::vector; int main() { vector<int> vInts(5,100); for(int i=0;i<5;i++) { std::cout << "Vector : "<< i << "-"<< vInts[i]<<"\n"; } int nSize= vInts.empty() ? -1 : static_cast<int>(vInts.size()); std::cout << "Vector Size:"<<nSize<<"\n"; vInts.push_back(int(200)); int nSize1 = vInts.empty() ? -1 : static_cast<int>(vInts.size()); std::cout << "Vector Size after a push_back:"<<nSize1<<"\n"; std::cout << "Vector at last :"<<vInts.at(nSize1-1)<<"\n"; std::cout << "Vector at first :"<<vInts.front()<<"\n"; vInts.erase(vInts.begin(),vInts.end()); int nSize3 = vInts.empty() ? -1 : static_cast<int>(vInts.size()); std::cout << "Vector Size after erase:"<<nSize3<<"\n"; std::cout << "Vector is awesome!!!! \n"; }
run
|
edit
|
history
|
help
0
ThreadPool
cppPyGuessTheNum2
Wipro Problem 1
A • Potato Sacks
Get all anagrams from given words
same
Minimum number of jumps DP
BInTree Traversal
Korelacja Pearsona lol
cppPyClamInher