Guest User

Untitled

a guest
Aug 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. const int MAX = 50;
  7. void display(Date *, int);
  8. int info(Date *, int);
  9.  
  10. struct Date
  11. {
  12.     int month;
  13.     int day;
  14.     int year;
  15. };
  16.  
  17. int main (int argc, const char* argv[])
  18. {
  19.     fstream data;
  20.    
  21.     Date *dates[MAX] = {0};
  22.  
  23.     int size = info(*dates, MAX);
  24.     display(*dates, size);
  25.  
  26.  
  27.  
  28. //  data.write
  29.  
  30.     return 0;
  31. }
  32.  
  33. int info(Date *p, int size)
  34. {
  35.     char slash;
  36.     int i = 0;
  37.     int first;
  38.  
  39.     do
  40.     {
  41.         cout << "Enter a date (0 to end): ";
  42.         cin >> first;
  43.         p[i].month = first;
  44.         cin >> slash >> p[i].day >> slash >> p[i].year;
  45.         i++;
  46.     } while (first != 0);
  47.    
  48.     return i;
  49. }
  50.  
  51. void display(Date *p, int size)
  52. {
  53.     for(int i = 0; i < size; i++)
  54.     {
  55.         cout << "Dates list: \n"
  56.         << p++ -> month << '/'
  57.         << p++ -> day << '/'
  58.         << p++ -> year << endl;
  59.     }
  60. }
Add Comment
Please, Sign In to add comment