Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Date.cpp : Defines the entry point for the console application.
- //exercises: 1-5.
- #include "stdafx.h"
- #include "../../../../std_lib_facilities.h"
- using namespace std;
- struct Date {
- int y; //rok
- int m; //miesiąc
- int d; //dzień
- };
- //Funkcje Pomocnicze:
- void init_day(Date& dd, int y, int m, int d)
- {
- if (dd.y < 0) error("Y");
- dd.y = y;
- if (dd.m > 12 || dd.m < 1) error("m");
- dd.m = m;
- if (dd.d > 31 || dd.m < 1) error("d");
- dd.d = d;
- }
- void add_day(Date& dd,int n)
- {
- ;
- }
- void f()
- {
- Date today;
- init_day(today,1978,7,20);
- add_day(today, 1);
- }
- ostream& operator<<(ostream& os, Date d)
- {
- return os << Date();
- }
- int main()
- try{
- Date today;
- init_day(today, 1978, 7, 20);
- cout << today.y<<", "<<today.m<<","<<today.d<<endl;
- cout << today;
- //Date tommorow;
- }
- catch (exception& e) { cerr << e.what(); }
- catch (...) { cerr << "Exception: "; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement