#include using namespace std; class Date { int day; int month; int year; public: Date() : day(0), month(0), year(0) {} void input() { cout << "Enter day: "; cin >> day; cout << "Enter month: "; cin >> month; cout << "Enter year: "; cin >> year; } bool isValid() { if (month < 1 || month > 12) return 0; if (day < 1 || day > 31) return 0; if ((month == 4 || month == 6 || month == 9 || month == 11) && day > 30) return 0; if (month == 2) { if (year % 4 == 0) { if (day > 29) return 0; } else { if (day > 28) return 0; } } return 1; } }; int main() { Date date; date.input(); if (date.isValid()) cout << "Valid date." << endl; else cout << "Invalid date." << endl; return 0; }#include using namespace std; class Date { int day; int month; int year; public: Date() : day(0), month(0), year(0) {} void input() { cout << "Enter day: "; cin >> day; cout << "Enter month: "; cin >> month; cout << "Enter year: "; cin >> year; } bool isValid() { if (month < 1 || month > 12) return 0; if (day < 1 || day > 31) return 0; if ((month == 4 || month == 6 || month == 9 || month == 11) && day > 30) return 0; if (month == 2) { if (year % 4 == 0) { if (day > 29) return 0; } else { if (day > 28) return 0; } } return 1; } }; int main() { Date date; date.input(); if (date.isValid()) cout << "Valid date." << endl; else cout << "Invalid date." << endl; return 0; } #include using namespace std; class Student { static int rollNo; string name; int age; string studentClass; public: Student() : name(""), age(0), studentClass("") {} void input() { cout << "Enter name: "; cin >> name; cout << "Enter age: "; cin >> age; cout << "Enter class: "; cin >> studentClass; rollNo++; } void output() { cout << "Name: " << name << endl; cout << "Age: " << age << endl; cout << "Class: " << studentClass << endl; } static void printTotalStrength() { cout << "Total Strength: " << rollNo << endl; } }; int Student::rollNo = 0; int main() { Student s1, s2, s3; s1.input(); s2.input(); s3.input(); cout << "\nStudent 1 Details:" << endl; s1.output(); cout << "\nStudent 2 Details:" << endl; s2.output(); cout << "\nStudent 3 Details:" << endl; s3.output(); Student::printTotalStrength(); return 0; }