Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
TupleCPP
//g++ 7.4.0 //this code is created by Rezaul Hoque on October 07,2021;contact: jewelmrh@yahoo.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 <fstream> #include <iostream> #include <iomanip> #include <string> #include <tuple> int main() { std::cout<<"^"; std::cout.width(25); std::cout.fill('^'); std::cout<<"\n"; std::cout<<"^"; std::cout.width(25); std::cout.fill('^'); std::cout<<"\n"; std::tuple<std::string,char> tup1;//default tup1 =std::make_tuple("\nTime",':'); std::tuple<std::string,char> tup2(tup1);//copy std::tuple<char,char,char> tup3(std::make_tuple('O','c','t'));//move auto tup4= std::make_tuple(7,2021); std::tuple<std::string,int> tuptop; tuptop= std::make_tuple("\nTuple in action:\n",1); std::string title; std::tie(title,std::ignore)=tuptop; std::cout<<title<<"\n"; std::cout<<std::get<0>(tup3); std::cout<<std::get<1>(tup3); std::cout<<std::get<2>(tup3); std::cout<<" "; std::cout<<std::get<0>(tup4); std::cout<<","; std::cout<<std::get<1>(tup4); std::tuple<float, std::string> time(12.40," hours\n"); std::tuple<double, std::string> hr(time);//conversion auto tuptime = std::tuple_cat(tup2,hr); std::cout<<"\n"; std::cout<<std::get<0>(tuptime); std::cout<<std::get<1>(tuptime); std::cout.setf(std::ios::showpoint); std::cout<<std::get<2>(tuptime); std::cout<<std::get<3>(tuptime); auto sig=std::make_tuple("\n --","Rezaul Hoque\n"); std::cout<<std::get<0>(sig); std::cout<<std::get<1>(sig); std::cout<<"^"; std::cout.width(25); std::cout.fill('^'); std::cout<<"\n"; std::cout<<"^"; std::cout.width(25); std::cout.fill('^'); std::cout<<"\n"; return 0; }
run
|
edit
|
history
|
help
0
Networked path_dp
Network UVa
MovConstrAssign4
RegexReplace
FindKthElementDivideConquer
Facebook - Split into monotonic sequences
g++ -g bug
Search in a rotated sorted array
Adress
articulation points and bridges