├── 3D Vector └── Vector3f.cpp ├── LICENSE ├── Operator └── operator.c ├── README.md ├── Variable ├── Readme.md └── main.cpp ├── basic ├── README.md └── main.c ├── license └── server_client └── readme.md /3D Vector/Vector3f.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct Vector3f { 4 | float x; float y; float z; 5 | 6 | Vector3f() {} 7 | 8 | Vector3f(float _x, float _y, float _z) { 9 | x = _x; y = _y; z = _z; 10 | } 11 | 12 | Vector3f(const float* pFloat) { 13 | x = pFloat[0]; y = pFloat[0]; z = pFloat[0]; 14 | } 15 | 16 | Vector3f(float f) { 17 | x = y = z = f; 18 | } 19 | 20 | Vector3f& operator+=(const Vector3f& r) { 21 | x += r.x; y += r.y; z += r.z; 22 | 23 | return *this; 24 | } 25 | 26 | Vector3f& operator-=(const Vector3f& r) { 27 | x -= r.x; y -= r.y; z -= r.z; 28 | 29 | return *this; 30 | } 31 | 32 | Vector3f& operator*=(float f) { 33 | x *= f; y *= f; z *= f; 34 | 35 | return *this; 36 | } 37 | 38 | operator const float*() const { 39 | return &(x); 40 | } 41 | 42 | 43 | Vector3f Cross(const Vector3f& v) const; 44 | 45 | Vector3f& Normalize(); 46 | 47 | void Rotate(float Angle, const Vector3f& Axis); 48 | 49 | void Print() const { 50 | printf("(%.02f, %.02f, %.02f)", x, y, z); 51 | } 52 | }; 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 izal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Operator/operator.c: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | MIT License 4 | 5 | Copyright (c) 2023 izal 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | 25 | */ 26 | #include 27 | #include 28 | 29 | int main() { 30 | int a; 31 | int b; 32 | int c; 33 | int d; 34 | int increase; 35 | int decrease; 36 | int equal = 2; 37 | int equality = 3; 38 | int NotEqual = 2; 39 | int AddAssign; 40 | int SubtAssign; 41 | int logicOR = 3; 42 | int logicAND = 3; 43 | int bitw = 2; 44 | int bitwAND; 45 | int bitwOR; 46 | // To add two numbers 47 | a = 2+4; 48 | // To subtract two numbers 49 | b = 4-2; 50 | // To multiply two numbers 51 | c = 5*2; 52 | // To divide two numbers 53 | d = 6/2; 54 | // This is a special operator that simply ments the value by 1. You will see this used later in this book when loops are discussed. 55 | increase++; 56 | decrease = 3; 57 | decrease--; 58 | 59 | printf("a = %d\n", a); 60 | printf("b = %d\n", b); 61 | printf("c = %d\n", c); 62 | printf("d = %d\n\n", d); 63 | 64 | printf("increase = %d\n", increase); 65 | printf("decrease = %d\n", decrease); 66 | printf("equal = %d\n", equal); 67 | 68 | // Double equals adalah operator kesetaraan. Ia bertanya "apakah yang di kiri sama dengan yang di kanan?" Ini sering digunakan dalam pernyataan if (yang akan Anda lihat di bab selanjutnya!) 69 | if(equality == 3) { 70 | printf("equality its 3\n"); 71 | } 72 | // Tidak sama dengan 73 | if(NotEqual != 3) { 74 | printf("No Equal its 3\n"); 75 | } 76 | // Tambahkan lalu tetapkan 77 | AddAssign+=1; 78 | printf("Add then assign = %d\n", AddAssign); 79 | // Kurangi lalu tetapkan 80 | SubtAssign-=1; 81 | printf("Add then assign = %d\n", SubtAssign); 82 | // Ini adalah operator OR yang logis. 83 | if(logicOR == 1 || logicOR == 3) { 84 | printf("logicOR its 3\n"); 85 | } 86 | // Ini adalah operator AND yang logis 87 | if(logicAND == 3 && logicAND == 3) { 88 | printf("logicAND its 3\n"); 89 | } 90 | // Pergeseran bitwise ke kanan 91 | if(bitw >> 1) { 92 | printf("Bitw Greate then 1\n"); 93 | } 94 | // Pergeseran bitwise ke Kiri 95 | if(bitw << 1) { 96 | printf("Bitw Less then 1\n"); 97 | } 98 | bitwAND = 2&2; 99 | printf("Bitwise AND = %d\n", bitw); 100 | bitwOR = 2|2; 101 | printf("Bitwise OR = %d\n", bitw); 102 | 103 | getch(); 104 | return 0; 105 | } 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Welcome to Kelincidev 2 | 3 | C++ is a popular programming language. 4 | C++ is used to create computer programs. 5 | 6 | You can use the [editor on GitHub](https://github.com/SpiderCG/C/edit/master/README.md) to maintain and preview the content for your website in Markdown files. 7 | 8 | Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. 9 | 10 | ### Markdown 11 | 12 | Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for 13 | 14 | ```markdown 15 | Syntax highlighted code block 16 | 17 | #include 18 | 19 | main() { 20 | std::cout<<"Hellow"; 21 | } 22 | 23 | ``` 24 | 25 | For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). 26 | -------------------------------------------------------------------------------- /Variable/Readme.md: -------------------------------------------------------------------------------- 1 | Definisi variabel mengalokasikan penyimpanan untuk variabel dan juga dapat menentukan nilai awal untuk variabel. Harus ada satu dan hanya satu definisi variabel dalam suatu program 2 | 3 | Deklarasi #extern bukanlah definisi dan tidak mengalokasikan penyimpanan. Akibatnya, ia mengklaim bahwa definisi variabel ada di tempat lain dalam program. Sebuah variabel dapat dideklarasikan beberapa kali dalam sebuah program, tetapi harus didefinisikan hanya sekali. 4 | -------------------------------------------------------------------------------- /Variable/main.cpp: -------------------------------------------------------------------------------- 1 | int value; 2 | char character; 3 | bool valueTF; 4 | float tovalue; 5 | double dvalue; 6 | short shortvalue; 7 | long longvalue; 8 | -------------------------------------------------------------------------------- /basic/README.md: -------------------------------------------------------------------------------- 1 | hello 2 | ```markdown 3 | // An example program to demonstrate working 4 | // of enum in C 5 | #include 6 | 7 | enum week{Mon, Tue, Wed, Thur, Fri, Sat, Sun}; 8 | 9 | int main() 10 | { 11 | enum week day; 12 | day = Wed; 13 | printf("%d",day); 14 | return 0; 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /basic/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | main() { 4 | printf("hai dunia"); 5 | } 6 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 izal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /server_client/readme.md: -------------------------------------------------------------------------------- 1 | contact me for source code 2 | --------------------------------------------------------------------------------