C + + Programming for Determining Leap Year or Not Leap Year
# include <cstdlib>
# include <iostream>
using namespace std;
Leap class {
friend ostream & operator << (ostream &, Leap &);
friend istream & operator >> (istream &, Leap &);
public:
Intercalary () {};
void process () {
if (year% 4 == 0) {
result = "Leap Year";
} else result = "No Leap Year";
}
private:
int year;
char * result;
};
istream & operator >> (istream & in, Leap & insert) {
cout << "Enter year:";
in >> Enter.year;
return in;
}
ostream & operator << (ostream & out, Leap & output) {
cout << "Year" << output.year << "is" << output.result;
return out;
}
int main (int argc, char * argv [])
{
Leap year;
cin >> year;
year.proses ();
cout << year;
cout << endl;
system ("PAUSE");
return 0;
}
Comments
Post a Comment