#include <iostream>
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 <iostream>
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<iostream>
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;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}