Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
CurDayMessage
//g++ 7.4.0 /////////////////////////////////////////////////////////////////////////////////CurDayMessage: example of generating current date and printing an appropriate message //this code is created by Rezaul Hoque on May 26,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 <ctime> #include <string> class Date{ int day,month,year; public: Date(){} Date(int a,int b,int c){day=a;month=b;year=c;} ~Date(){} Date(Date&c){day=c.day;month=c.month; year=c.year;} int getDay(){return day;} int getMonth(){return month;} int getYear(){return year;} void display(){ std::cout<<getDay();std::cout<<"/"; std::cout<<getMonth();std::cout<<"/"; std::cout<<getYear();} }; int main() { Date *p; p=new Date[3]; p[0]=Date(26,5,2022); p[1]=Date(27,5,2023); p[2]=Date(28,5,2022); std::string m[3]; m[0]={"It's Thursday!"}; m[1]={"It's Friday! "}; m[2]={"It's Saturday!"}; std::time_t w=std::time(nullptr); std::tm* now= std::localtime(&w); int y,j,mo; j=now->tm_mday; mo=now->tm_mon+1; y=now->tm_year+1900; for(int h=0;h<3;h++){ if(y==p[h].getYear() && mo==p[h].getMonth() && j==p[h].getDay() ) { std::cout<<m[h]<<" \n"; p[h].display(); } } delete [] p; return 0; }
run
|
edit
|
history
|
help
0
simple calculator
Test 12(2021)
1234
RegexMatch
DSU on tree (http://codeforces.com/contest/600/problem/E)
MapGrocery
F-Random Strings
Policy based smart pointer
12hours Clock c++
Two-phase sample with GCC