#include <iostream>
using namespace std;
class Date{
int day,month,year;
public:
Date(){
cin >> day >> month >> year;
}
void getDate(){
switch(month){
case 1: cout << "January ";
break;
case 2: cout << "February ";
break;
case 3: cout << "March ";
break;
case 4: cout << "April ";
break;
case 5: cout << "May ";
break;
case 6: cout << "June ";
break;
case 7: cout << "July ";
break;
case 8: cout << "August ";
break;
case 9: cout << "September ";
break;
case 10: cout << "October ";
break;
case 11: cout << "November ";
break;
case 12: cout << "December ";
break;
}
cout << day << " " << year;
}
};
int main() {
Date D;
D.getDate();
return 0;
}
using namespace std;
class Date{
int day,month,year;
public:
Date(){
cin >> day >> month >> year;
}
void getDate(){
switch(month){
case 1: cout << "January ";
break;
case 2: cout << "February ";
break;
case 3: cout << "March ";
break;
case 4: cout << "April ";
break;
case 5: cout << "May ";
break;
case 6: cout << "June ";
break;
case 7: cout << "July ";
break;
case 8: cout << "August ";
break;
case 9: cout << "September ";
break;
case 10: cout << "October ";
break;
case 11: cout << "November ";
break;
case 12: cout << "December ";
break;
}
cout << day << " " << year;
}
};
int main() {
Date D;
D.getDate();
return 0;
}
not passing the test case 6
ReplyDeleteno it is working fine(all test cases are passed)
DeleteSorry, to say but the test case 6 in this one is not resolving
DeleteThe test case 6 is having an invalid date as input; so your solution works because you didn't define a 'default'. Nice!
Delete