Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cppPyDicCom
//g++ 7.4.0 //cppPyDicCom: C++ equivalent of PyDicCom program //this code is created by Rezaul Hoque on February 09,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 <map> #include <string> //PyDicCom(created on December 28,2021) looks like: /***” dayTemF={ 'Mon': 50, 'Tue':60, 'Wed':70, 'Thu':80, } print(dayTemF) dayTemC={day:(temp-32)*5/9 for (day,temp) in dayTemF.items()} print(dayTemC) ***/ //C++ equivalent of above program is: int main() { std::map<std::string,int> dayTemC; dayTemC["'Mon'"]=50; dayTemC["'Tue'"]=60; dayTemC["'Wed'"]=70; dayTemC["'Thu'"]=80; std::cout<<"Day Temperature in Fahrenheit:\n"; std::cout<<"{"; for(std::map<std::string,int>::iterator it=dayTemC.begin();it!=dayTemC.end();it++){ std::cout<<it->first<<" : "<<it->second<<",\t";} std::cout<<"}"; std::cout<<"\nDay Temperature in Celsius:\n"; std::cout<<" {"; for(std::map<std::string,int>::iterator it=dayTemC.begin();it!=dayTemC.end();it++){ std::cout<<it->first<<" : "<<(it->second-32)*5/9<<",\t";} std::cout<<"}"; return 0; }
run
|
edit
|
history
|
help
0
Test 12(2021)
Test 2(2021)
prime factorization trial division
Client
weak_ptr and Circle_reference
UnghiLansator
a ko z and z ko n string printing
Longest Consecutive Subsequence
Synchro#3
Test 6(2020)