Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by iswffkuhu676r7 ( 8 years ago )
class Invalid {};

class Date
{
private:
 int y, m, d;
public:
 Date(int yy, int mm, int dd)
 {
  if (yy > 0 && yy < 2020 xss=removed> 0 && mm < 13 xss=removed> 0 && dd < 32)
   d = dd;
  else throw Invalid{};
 }
 
 void add_day()
 {
  d++;
 }
 
 int day() { return d; }
 int month() { return m; }
 int year() { return y; }
}


int main()
{
 //get all different versions of Date to work.
 //for each version define a Date called today as June 25, 1978
 //The  define a date called tomorrow, and give a value by copying today into it and
 //adding its day by using add_day()
 //finally, output today and tomorrow using << defined as in section 9.8

 try
 {
  std::cout << "Ello" << std::endl;
  
 }
 catch (Invalid)
 {
  std::cerr << "caight invalid date\n";
 }
 catch (...)
 {
  std::cerr << "Error: caught an unknown exception\n";
 }

 
 return 0;
}

 

Revise this Paste

Your Name: Code Language: