#include <iostream> class box_world { public: void greeting() const { std::cout << "Cheers, c++ !" << std::endl; } }; int main() { auto box = box_world{}; box.greeting(); }
#include <algorithm> int main() { // c++ array char src[] = {"Hello, c++!"}; // Note: src[11] == '\0' int size = 11 + 1; char * dst = new char[size]; std::copy(src, src+size, dst); delete [] dst; }
#include <algorithm> int main() { // c++ array char src[100]; std::fill(src, src+100, '0'); }
Get Random Number
std::random_device seed; std::mt19937 rng{seed()}; auto rd_value = rng(); std::cout << rd_value << std::endl;