#include <algorithm>
#include <iostream>
int main()
{
int arraylen = 4;
int myArray[4] = { 1, 2, 3, 4 };
for (int i =0; i < arraylen; ++i)
std::cout << myArray[i] << ' ';
std::cout << '\n';
//http://e...content-available-to-author-only...e.com/w/cpp/algorithm/remove
arraylen = std::remove(myArray, myArray + arraylen, 2) - myArray;
for (int i =0; i < arraylen; ++i)
std::cout << myArray[i] << ' ';
std::cout << '\n';
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKSAKewoJaW50IGFycmF5bGVuID0gNDsKCWludCBteUFycmF5WzRdID0geyAxLCAyLCAzLCA0IH07Cglmb3IgKGludCBpID0wOyBpIDwgYXJyYXlsZW47ICsraSkKCQlzdGQ6OmNvdXQgPDwgbXlBcnJheVtpXSA8PCAnICc7CglzdGQ6OmNvdXQgPDwgJ1xuJzsKCQoJLy9odHRwOi8vZS4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uZS5jb20vdy9jcHAvYWxnb3JpdGhtL3JlbW92ZQoJYXJyYXlsZW4gPSBzdGQ6OnJlbW92ZShteUFycmF5LCBteUFycmF5ICsgYXJyYXlsZW4sIDIpIC0gbXlBcnJheTsKCglmb3IgKGludCBpID0wOyBpIDwgYXJyYXlsZW47ICsraSkKCQlzdGQ6OmNvdXQgPDwgbXlBcnJheVtpXSA8PCAnICc7CglzdGQ6OmNvdXQgPDwgJ1xuJzsKfQ==