Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- const int MAX = 50;
- void display(Date *, int);
- int info(Date *, int);
- struct Date
- {
- int month;
- int day;
- int year;
- };
- int main (int argc, const char* argv[])
- {
- fstream data;
- Date *dates[MAX] = {0};
- int size = info(*dates, MAX);
- display(*dates, size);
- // data.write
- return 0;
- }
- int info(Date *p, int size)
- {
- char slash;
- int i = 0;
- int first;
- do
- {
- cout << "Enter a date (0 to end): ";
- cin >> first;
- p[i].month = first;
- cin >> slash >> p[i].day >> slash >> p[i].year;
- i++;
- } while (first != 0);
- return i;
- }
- void display(Date *p, int size)
- {
- for(int i = 0; i < size; i++)
- {
- cout << "Dates list: \n"
- << p++ -> month << '/'
- << p++ -> day << '/'
- << p++ -> year << endl;
- }
- }
Add Comment
Please, Sign In to add comment