From 37237f67f8e42a0c6b6c73005478f9aad800415c Mon Sep 17 00:00:00 2001 From: kaltinsoy Date: Sun, 30 Nov 2025 01:51:19 +0300 Subject: [PATCH] initial --- a.out | Bin 0 -> 12928 bytes charP.cpp | 24 ++++++++++++++++++++++++ classTest.cpp | 31 +++++++++++++++++++++++++++++++ funcT.cpp | 20 ++++++++++++++++++++ hello.cpp | 9 +++++++++ importT.cpp | 8 ++++++++ limits.cpp | 13 +++++++++++++ stringConcatenation.cpp | 19 +++++++++++++++++++ sumV.cpp | 21 +++++++++++++++++++++ swap2.cpp | 20 ++++++++++++++++++++ testParenth.cpp | 8 ++++++++ vectorTest.cpp | 18 ++++++++++++++++++ 12 files changed, 191 insertions(+) create mode 100755 a.out create mode 100644 charP.cpp create mode 100644 classTest.cpp create mode 100644 funcT.cpp create mode 100644 hello.cpp create mode 100644 importT.cpp create mode 100644 limits.cpp create mode 100644 stringConcatenation.cpp create mode 100644 sumV.cpp create mode 100644 swap2.cpp create mode 100644 testParenth.cpp create mode 100644 vectorTest.cpp diff --git a/a.out b/a.out new file mode 100755 index 0000000000000000000000000000000000000000..28bc3c740af59690f5c771fbca31b2d1ea1c9868 GIT binary patch literal 12928 zcmeHNeQX?85r21f5{KsF5;xRo+UBT|Drw`*o$Z*!N!zuZv(J%}xVDpqin3YXUF?(Y z!@66ycKK)^km9CAp%Mk5O5`sTiHbi^|0sXZrUa5yAmj=mS)wWtP?1t-T}Uf~+8n=m zJ9FOKoFh~a64K3Sci#No%)Hszk9%)+ACL9-1Oovj6jb*qlFrnb8glna9lu+PjO|n_ zm8rsNqgo229-FCqh`TM}vq85*cmwOzfs>sIF%UA{2J_n(7A_GIU&4JZGg)%^F76aA z{>kn}%{hT_;2|E~SJ{L+^n@s()$!5qtN< z&0C(Y`^MIN_ixDlIDW_9SKsl^_=&$X#7`~x);6W$UpwanOEd8kKWjJ-E0;<;o0Epg!Uefwsen+$Ex%eyZ+#i2szAhfP5P$8Ov!?7}8GG>C)A+~leIG%o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;y=N1>`?_^BsH4O0ZgU}Xce6lDz#ZFk;&&$ zMQA4T)@UX_VrQ(RlP?r4dty>0^4alB%1I@SNOcYC7#{SNT`1U7Rx0Ndrqr>5olRNE ziEMTXCLT%GaVu048M{~SC?iuXdAG2Zy_EM?Y!e6Wvi(4)j-#e(R zy`MSIxxcSlS-t%SyE^-=gFQV%F%*_NyZU3WNF{B@R#x9Z)QFSmoHbEQC6z7|fBb5- z>8TS_DvEh)%tqNeMYZtO{q|&cG?qp=obrKwUxnJWb_>o{GGpn#K-)=C5gUJr)_8is zPmA`$1$L>8R}Sxv*gldT9ZeNtsEyOVEk+&Q-z{0AvOHDGD-A8mj9WQJnsQ0lj1-Fk zz-F=XyVnhs$;&SQydCgX@s>at#i^`gkAOP`mybzH&r?Qo6UN9y8n0KB7Z9?p5i7s_(?0v7b*5H5%J#0LA-&V{Ikbegq3s?24BMY!`=_YWLt-aT2O3^` z`9Ipme=xFc6McXDCfiH?REQ7|4tfFM~fy3+OWkD!CrYGNaL?~AJ@`?o!HCqe;xf~ z-^F^eemz^op4Pa2`)7brUS)ilN6oRl96!4++l%~NpM81$*XU~O5k=+h`3-sJhC z$@ahW*-QKa{|F85{lDB6Gj}&w+dGW!^8}Lx+9#{`h~5{#Drcb}i4l<$GiQ zcp?k`9c(dcF5AmIe})zoAklNB1zGU7(Lv8H8DHkv^4+Yjsc**@=k4H={w + +using namespace std; + +int countX (const char *p, const char *x) { + if (p==nullptr) { + return 0; + } + + int count = 0; + + for (; *p != 0; p++) { + if (*p == *x) { + count++; + } + } + return count; +} + +int main (void) { + cout << countX("Haaay, Koray", "a") << endl; + + return 0; +} diff --git a/classTest.cpp b/classTest.cpp new file mode 100644 index 0000000..34226d5 --- /dev/null +++ b/classTest.cpp @@ -0,0 +1,31 @@ +#include + +class Max { + private: + int mInt1, mInt2; + + public: + int int1, int2; + Max(int int1, int int2) : + mInt1 {int1}, mInt2 {int2} + { + } + + int bigger() { + if (int2 >= int1) { + return int2; + } else { + return int1; + } + } +}; + +int main(void) { + int x = 5, y = 7; + + Max max{x, y}; + + std::cout << max.bigger() << std::endl; + + return 0; +} diff --git a/funcT.cpp b/funcT.cpp new file mode 100644 index 0000000..9ec5aad --- /dev/null +++ b/funcT.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +int fun1 (int); +int fun2 (int); + +int main (void) { + cout << fun1(4) + fun2(3) << endl; + + return 0; +} + +int fun1 (int i) { + return i; +} + +int fun2 (int j) { + return j; +} diff --git a/hello.cpp b/hello.cpp new file mode 100644 index 0000000..bb90336 --- /dev/null +++ b/hello.cpp @@ -0,0 +1,9 @@ +#include +using namespace std; + +int main (void) { + + cout << "Hello world!" << endl; + return 0; + +} diff --git a/importT.cpp b/importT.cpp new file mode 100644 index 0000000..a8007d2 --- /dev/null +++ b/importT.cpp @@ -0,0 +1,8 @@ +import std; + + +int main (void) { + std::cout << "Hello World!"; + + return 0; +} diff --git a/limits.cpp b/limits.cpp new file mode 100644 index 0000000..51428b0 --- /dev/null +++ b/limits.cpp @@ -0,0 +1,13 @@ +#include +#include + +using namespace std; + +int main (void) { + + cout << INT_MAX << endl; + cout << INT_MIN << endl; + + return 0; + +} diff --git a/stringConcatenation.cpp b/stringConcatenation.cpp new file mode 100644 index 0000000..13c7b27 --- /dev/null +++ b/stringConcatenation.cpp @@ -0,0 +1,19 @@ +#include +#include +using namespace std; +// return a string that contains n As +// In Java this code takes forever +string makeLongString( int n ) +{ +string result = ""; +for( int i = 0; i < n; i++ ) +result += "A"; +return result; +} +int main( ) +{ +string manyAs = makeLongString( 250000 ); +cout << "Short string is " << makeLongString( 20 ) << endl; +cout << "Length is " << manyAs.length( ) << endl; +return 0; +} diff --git a/sumV.cpp b/sumV.cpp new file mode 100644 index 0000000..4c1e2a0 --- /dev/null +++ b/sumV.cpp @@ -0,0 +1,21 @@ +#include +#include + +using namespace std; + +int vectorSum(const vector& v) { + int result = 0; + for(const int i : v) { + result += i; + } + return result; +} + +int main (void) { + + vector nums {2, 4, 6, 8, 10}; + cout << vectorSum(nums) << endl; + + return 0; + +} diff --git a/swap2.cpp b/swap2.cpp new file mode 100644 index 0000000..e6160bb --- /dev/null +++ b/swap2.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +void swap2 (int &val1, int &val2) { + int temp = val1; + val1 = val2; + val2 = temp; + } + +int main (void) { + int x = 1; + int y = 3; + + swap2(x, y); + + cout << x << y << endl; + + return 0; +} diff --git a/testParenth.cpp b/testParenth.cpp new file mode 100644 index 0000000..5bc15f7 --- /dev/null +++ b/testParenth.cpp @@ -0,0 +1,8 @@ +#include +using namespace std; + +int main (void) { + int num {6}; + cout << num << endl; + return 0; +} diff --git a/vectorTest.cpp b/vectorTest.cpp new file mode 100644 index 0000000..ddde2b8 --- /dev/null +++ b/vectorTest.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace std; + +int main (void) { + vector squares; + + for (int i = 0; i < 100; i++) { + squares.push_back(i * i); + } + + for (int j = 0; j < squares.size(); j++) { + cout << j << "squared is: " << squares[j] << endl; + } + + return 0; +}