Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
UtilityPair
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////////// //UtilityPair: understanding std::pair //this code is created by Rezaul Hoque on August 26,2022;update: 14:58 //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 <iomanip> #include <string> #include <strstream> #include <utility> //stream manipulator std::ostream& l(std::ostream& os) { return (os<<"\n"); } namespace Pat { void fill(char c) { std::cout.width(40); std::cout.fill(c); std::cout<<l; } void left(int n,char c){ std::cout.setf(std::ios::left); std::cout.fill(c); std::cout.width(n); } void right(int n,char c){ std::cout.setf(std::ios::right); std::cout.fill(c); std::cout.width(n); } } int main () { Pat::fill('&'); std::pair<std::string ,int> a("zenyth",110); std::pair<std::string,int> c=std::make_pair("asterix",112); std::pair<std::string,int> b,d; std::pair<std::string,std::pair<int,int>> date={"August ",{26,2022}}; b.first="fountliv"; b.second=234; d=b; std::string m; int x,y; Pat::left(18,' '); std::cout<<"City"<<"Code\n"; Pat::left(18,'.'); std::cout<<a.first<<a.second<<l; Pat::left(18,'.'); std::cout<<c.first<<c.second<<l; Pat::left(18,'.'); std::cout<<d.first<<d.second<<l; m=date.first; std::tie(x,y)=date.second; Pat::right(25,' '); std::cout<<m<<","<<x<<" "<<y<<l; Pat::fill('&'); return 0; }
run
|
edit
|
history
|
help
0
Polimorfizm :)
top5words
cppOverride
BOOST_ENABLE_ASSERT_HANDLER defined
Subarray with 0 sum
C++ Car Racing game framework
hacker
20201123
String match with test
c++ car racing game