From be1ce9386484e227bde62e0600ce70475583e66d Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Sun, 5 May 2019 21:01:16 +0200 Subject: [PATCH] Added z7" --- zad2_2 | Bin zad3_1 | Bin zad5_1 | Bin zad7_1 | Bin 0 -> 14344 bytes zad7_1.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ zad7_2 | Bin 0 -> 14192 bytes zad7_2.cpp | 34 ++++++++++++++++++++++++++++++ zad7_3.cpp | 20 ++++++++++++++++++ 8 files changed, 113 insertions(+) mode change 100755 => 100644 zad2_2 mode change 100755 => 100644 zad3_1 mode change 100755 => 100644 zad5_1 create mode 100644 zad7_1 create mode 100644 zad7_1.cpp create mode 100644 zad7_2 create mode 100644 zad7_2.cpp create mode 100644 zad7_3.cpp diff --git a/zad2_2 b/zad2_2 old mode 100755 new mode 100644 diff --git a/zad3_1 b/zad3_1 old mode 100755 new mode 100644 diff --git a/zad5_1 b/zad5_1 old mode 100755 new mode 100644 diff --git a/zad7_1 b/zad7_1 new file mode 100644 index 0000000000000000000000000000000000000000..b9f747acca591bedfc4e4d65c656f4b244a3fc5a GIT binary patch literal 14344 zcmeHOeQ;FQb-$|>NCvS;d^kebW^sXnZPr>L31ORBE41(w1gKic#vk~x+FeOoOS|&! zTPzrp;0Q8a%SttlJEpDE@zjj#WZIOZO@=xR77@XACvNeSaWYLaQ9U?WHFm28N>vx5 z{?2{(tlmEDdP36v$DLW7cYf#No_p_k_r1M)^m%{l_9BNvaC3^^5yTxSGm%Cmc&1ui zfHaB*aTEUDCT~&y?5U?!IVOeeK zl1Rp5!M><*P(M%&>wr-kiG};}jq_86SdUqyj7}wP zla#7np?AifjK;!xdnB3akB~6LIgIoTJ+6m(AJ@Bs(LStSXfUV;jmTgWfl8)3N-KE? z{pe(<623nejfoxGw&|NZ)neP;y}qUv-Rs#TcC@xMfdyRasqtD_^IEU*)Ml@0Jau$u z6=5GQmY-r=7t3oWp3zP`H))42QTx7Aat`d`e}Q|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&sAc4vS*=5VAFm7U94czFyQ90)tQ4c3&9!73y(^iV zmD%eGsXWi_P1c=-k}0`eVEO0P7&bOqYS1V``1#EamA+MNx7c4GRx(y}@L!@PrS>;LoH+!jv394JUT_97cyM5$Ow(fw~&# zGlWMzIy|`a^u)oUdJuo*e0dUaxlwx}z3OSz8-^3+;2l+pk-<=8z|b)c?32=&`5-fW z@HP4j_D4gAl6HO%l1O;)5bei@ z+w-{uQ#WMRhS#~A<^^Z9H(a8S*iw1 z_H?#sxBn6_Qla>$@i{M3J`XjebJsr&fz_VRiI`5Xp`v^)%=87DJ)b8r<#^c*^Gv^D zv*&XsrtLg1TmS6u6`MVO|72=EKBKj=wy%Pr@$>pksF!}Gw&R&O_s=(M_V)juq4l*k zd;f1hXzicR#hC8pz?2i7H}?6q&7RNCnBK#Ric(+J_G2(~7Dc&Djn6&!|8jVpP3dg@ zaU4H~fWA7hJ)g%_-)dU0ULpHS5b(W4I(%-&|M$fI-^6La{x~i=x1up||NJ|Fwu-!= z4#XtcziiL+DkN6>?Dt`}X~Op@J77EJi(pI`_s`$6E8V6>rES6$YzpzW1aeZT&LZXo z+uvcs*`1ZzQbby4Zqx9T3YeZl)Cb4Ud0--wh@;c;Xez{jx3{2jsIi?lv{} Kyn*%Y_Wuh-*X`Q? literal 0 HcmV?d00001 diff --git a/zad7_1.cpp b/zad7_1.cpp new file mode 100644 index 0000000..2037517 --- /dev/null +++ b/zad7_1.cpp @@ -0,0 +1,59 @@ +#include +#include +#include + +using namespace std; + +class Vec2 { + private: + int x,y; + public: + Vec2(int _x, int _y){ + x=_x; + y=_y; + } + string toString(){ + stringstream s; + s << "[" << x << ", " << y << "]"; + return s.str(); + } + Vec2 operator+(const Vec2& vec){ + return Vec2(x+vec.x, y+vec.y); + } + Vec2 operator-(const Vec2& vec){ + return Vec2(x-vec.x, y-vec.y); + } + Vec2& operator+=(const Vec2& vec){ + x=vec.x+x; + y=vec.y+y; + return *this; + } + Vec2& operator-=(const Vec2& vec){ + x=vec.x-x; + y=vec.y-y; + return *this; + } + float operator*(const Vec2& vec){ + return (float)x*vec.x + (float)y+vec.y; + } + bool operator==(const Vec2& vec){ + if(x==vec.x && y==vec.y) return 1; + else return 0; + } + bool operator!=(const Vec2& vec){ + if(x==vec.x && y==vec.y) return 0; + else return 1; + } +}; + +int main(){ + Vec2 vec1 = Vec2(5,1); + Vec2 vec2 = Vec2(3,4); + Vec2 vec3 = vec1 + vec2; + cout << vec3.toString() << endl; + vec3+=vec2; + cout << vec3.toString() << endl; + vec3-=vec1; + cout << vec3.toString() << endl; + cout << vec3*vec2 << endl; +} \ No newline at end of file diff --git a/zad7_2 b/zad7_2 new file mode 100644 index 0000000000000000000000000000000000000000..74f246bbd2ae021e36413f33fa76be848e44c17d GIT binary patch literal 14192 zcmeHOeQ;CPmA|qCCW$Q@0u2xnL>f8}g0PGMlPp29E%V$M;*4cNw=M}$#&c9OiOm!4(&`66EkFCCc9*Jr)4(TT_!`icGGU$l1;rV zp#7cu?vbBlDbpmo`0zfTxPQgZgz2(Agrdsq<9r$dXwq^ zctyRq2ER9po5Vuk4oNflUK4<8wi#ub;UY!11Cm~SnMo*wtCSo=_K@HL#VZEBbG=Dr zD1=KANRND7cauZ`U9!V)TKQ2;PRZtyzeFZIuhR1>J%-h+ry$Rd%+Ozlq8Gv@@Tf5) zS!!)>8)53NS}f5yFlLekL)QCa=#ig)XscF&?P|PIaXF{_XUOZYDHiSCTDK_{-WZF< z(}Noa>$h&)TIWtB+_iGvWS?Yr?b$0wqV-m$B!4Mzq7nbD`}|Y36VH#dl>g~B%42WY zep>d|PLf@QKVCN>s%4*O)RsL}(P;LH|4zcdEk#&&z~GW1^w&zzpN5@c^63)tEhXgN zC_$&_6tn-667=#Cc9xd#=S&ItAC-__TY|nC{yD^rCM>>Mtv53hl&UqkU#8NGxfZ_3k`hrQ_NCu+@2>w72KmK+wHg^Y8(U6`< z8OcbnzokR(sL}m_ZF>9NdjiHbT@MWodOV(5Qwl=ScyCLfP7iF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0!CxK87i1qpXpP|btj6NQl@|p*jRiE<& z3~$Yoo~z#k{`<%Q@%WriV95G-Op%SB!xbv_phK_ltUs(x=>Eq5c;^BN6hC8s||Na=y{z&Rzcu z7*>7G$1pt0iVCX7V|r7R?JM}T>T}+PA^WSubN(~^8wL9OUc~Sf3a+K`xJ-Hu9qag< z2V%(iQD7kzHZ{&K@c(})j5m+Z@ZX_Buf(j+d9V7L$lC0FHL+Qo z^)G_K*A~feevJQrk@fr_KI^exlpmrw@%WsFZ(B{$s9rKb?w9o$UIxdipL>6GnJRpp zvH{j(oNC30#^dw*@^Y6cvAiJQifl6RTMj;n)Z{2;hxKnOptCtEM)EKBL4V)}2oO$p8$uzaEZ{{U}a;P(Ik literal 0 HcmV?d00001 diff --git a/zad7_2.cpp b/zad7_2.cpp new file mode 100644 index 0000000..088e04d --- /dev/null +++ b/zad7_2.cpp @@ -0,0 +1,34 @@ +#include +#include +#include + +using namespace std; + +template +class Vec2 { + private: + num x,y; + public: + Vec2(num _x, num _y){ + x=_x; + y=_y; + } + string toString(){ + stringstream s; + s << "[" << x << ", " << y << "]"; + return s.str(); + } + Vec2 add(const Vec2& vec){ + return Vec2(x+vec.x, y+vec.y); + } + float multiply(const Vec2& vec){ + return (float)x*vec.x + (float)y*vec.y; + } +}; + +int main(){ + Vec2 vec1 = Vec2(5.5f,1.2f); + Vec2 vec2 = Vec2(3.4f,4.2f); + Vec2 vec3 = vec1.add(vec2); + cout << vec3.toString() << endl; +} \ No newline at end of file diff --git a/zad7_3.cpp b/zad7_3.cpp new file mode 100644 index 0000000..02741e2 --- /dev/null +++ b/zad7_3.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +template +class Array { + private: + type* ptrs; + Array(){} + ~Array(){} + public: + Array& operator new [](){ + Array(); + return *this; + } + void operator delete [](){ + ~Array(); + } + +} \ No newline at end of file