Advertisement
Guest User

Untitled

a guest
Oct 17th, 2022
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. void print_calendar(const date &d, const POTOM_NAZOVU_NORMALNO& di)
  2. {
  3.     CONSOLE_SCREEN_BUFFER_INFO inf;
  4.     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  5.     GetConsoleScreenBufferInfo(hConsole, &inf);
  6.     unsigned short prev = inf.wAttributes;
  7.     unsigned short red = 4;
  8.    
  9.    
  10.     int wd = weekday(d);
  11.    
  12.     cout << " П  В  С  Ч  П  С  В" << endl << endl;
  13.    
  14.     whitespace(wd * 3);
  15.    
  16.     for(int i = 1; i <= days_in_month(d.month(), d.year()); i++)
  17.     {
  18.         if(di.check(date(i, d.month(), d.year())))
  19.         {
  20.             SetConsoleTextAttribute(hConsole, red);
  21.             cout << setw(2) << i;
  22.             SetConsoleTextAttribute(hConsole, prev);
  23.         }
  24.         else
  25.             cout << setw(2) << i;
  26.        
  27.         cout << " ";
  28.         wd = (wd + 1) % 7;
  29.         if(wd == 0)
  30.             cout << endl;
  31.     }
  32.     cout << endl;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement