SHARE
TWEET

Untitled

a guest Oct 21st, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 13:
  2.  
  3. #include <iostream>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.  
  10.     int a,b,c,d,e,liczba_a,liczba_b,r,dzien,miesiac;
  11.     cout << "Podaj rok: ";
  12.     cin >> r;
  13.     if (r>=1800 && r<=1899) {
  14.         liczba_a = 23;
  15.         liczba_b = 4;
  16.     }
  17.     else if (r>=1900 && r<=2099) {
  18.         liczba_a = 24;
  19.         liczba_b = 5;
  20.     }
  21.     else if (r>=2100 && r<=2199) {
  22.         liczba_a = 24;
  23.         liczba_b = 6;
  24.     }
  25.     a = r%19;
  26.     b = r%4;
  27.     c = r%7;
  28.     d = ((a * 19) + liczba_a) % 30;
  29.     e = ( (2*b) + (4*c) + (6*d) + liczba_b ) % 7;
  30.     dzien = 22;
  31.     miesiac = 3;
  32.     //dzien = dzien + d + e;
  33.     if (d + e < 10) {
  34.         dzien = d+e+22;
  35.         miesiac = 3;
  36.     }
  37.     else {
  38.         dzien = d+e-9;
  39.         miesiac = 4;
  40.     }
  41.     if (d == 29 && e == 6) {
  42.         dzien = dzien - 7;
  43.     }
  44.     if (d==28 && e==6 && a>10) {
  45.         dzien = 29;
  46.         miesiac = 3;
  47.     }
  48.     cout << dzien << " " << miesiac << endl;
  49.  
  50.     system("pause");
  51.     return 0;
  52. }
  53. --------------------------------------------------------
  54. 14:
  55.  
  56. #include <iostream>
  57. #include <cstdlib>
  58. #include <math.h>
  59.  
  60. using namespace std;
  61.  
  62. int main() {
  63.  
  64.     int a,b,c,d,e,f,g,h,i,k,l,m,p,r,dzien,miesiac;
  65.     cout << "Podaj rok: ";
  66.     cin >> r;
  67.     a = r%19;
  68.     b = floor(r / 100);
  69.     c = r%100;
  70.     d = floor(b/4);
  71.     e = b%4;
  72.     f = floor((b+8) / 25);
  73.     g = floor((b-f+1)/3);
  74.     h = ((19*a)+b-d-g+15)%30;
  75.     i = floor(c/4);
  76.     k = c%4;
  77.     l = (32+(2*e)+(2*i)-h-k)%7;
  78.     m = floor((a+(11*h)+(22*l))/451);
  79.     p = (h+l-(7*m)+114)%31;
  80.     dzien = p+1;
  81.     miesiac = floor((h+l-(7*m)+114)/31);
  82.     cout << dzien << " " << miesiac << endl;
  83.  
  84.     system("pause");
  85.     return 0;
  86. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top