Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MapTel
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////////// //MapTel: example of map as class attribute //this code is created by Rezaul Hoque on August 05,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.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 <string> #include <map> using namespace std; namespace Tel{ class Tel{ map<std::string,std::string> l; public: Tel(){} Tel(map<std::string,std::string> m){l=m;} Tel(Tel& c){l=c.l;} ~Tel(){} map<std::string,std::string> getL(){ return l;} }; } int main() { Tel::Tel ad({{"Mr CBA","&%$#"}}); //another way to initiate the instance: ad({pair<std::string,std::string>("MrCBA","&%$#")}); /*** ad[Tel::Tel("Mr xyz","zyx")]="####"; ad[Tel::Tel("Mr zxc","cxz")]="%%%"; ad[Tel::Tel("Mr ASD","DSA")]="***"; ***/ for(auto& x: ad.getL()){ std::cout<<x.first<<":"<<x.second<<"\n";} return 0; }
run
|
edit
|
history
|
help
0
Boost phoenix. e.g 2: functor
subset sum=k(dp)
Algoritm(prelucrare cifre)
Rubix
Assigment operator (easy)
my template
poker.hpp
for.cc
TraceMarrix
Ballin primality test