├── .gitignore ├── LICENSE.md ├── Projects ├── C Projects │ ├── Advance (GUI) │ │ ├── README.md │ │ └── Sci. Calculator (GUI) │ │ │ ├── README.md │ │ │ └── main.c │ └── Basic │ │ ├── Avoid Missile │ │ ├── ReadMe.md │ │ └── avoid missile.c │ │ ├── Love-Calculator │ │ ├── Love-Calculator.md │ │ └── main.c │ │ ├── Modern Periodic Table │ │ ├── DATA │ │ ├── PERIODIC.C │ │ ├── PERIODIC.OBJ │ │ └── README.md │ │ ├── ReadMe.md │ │ └── Tic Tac Toe Game │ │ ├── README.md │ │ └── main.c ├── C++ Projects │ ├── Advance (GUI) │ │ ├── Basic Calculator (GUI) │ │ │ ├── Basic Calculator.cpp │ │ │ └── README.md │ │ └── README.md │ └── Basic │ │ ├── A Login and Registration System │ │ ├── LoginAndRegistration.cpp │ │ ├── README.md │ │ ├── data.txt │ │ ├── login.cpp │ │ └── login.h │ │ ├── AIO Calculator │ │ ├── AIO calculator.cpp │ │ └── README.md │ │ ├── Bank Management System │ │ ├── README.md │ │ └── main.cpp │ │ ├── CPP Magic Text │ │ ├── README.md │ │ └── text.cpp │ │ ├── Calculate CGPA and GPA │ │ ├── README.md │ │ └── main.cpp │ │ ├── Encryption and Decryption of Text │ │ ├── README.md │ │ └── main.cpp │ │ ├── Guessing Game │ │ ├── README.md │ │ └── text.cpp │ │ ├── Hotel Management System │ │ ├── README.md │ │ ├── Record.dat │ │ └── main.cpp │ │ ├── ReadMe.md │ │ ├── Supermarket Billing System │ │ ├── README.md │ │ └── main.cpp │ │ └── Temperature-calculator │ │ ├── README.md │ │ ├── temperature-calculator.cpp │ │ ├── temperature-calculator.exe │ │ └── temperature-calculator.o └── README.md ├── README.md └── Tutorials ├── C Basic Tutorials └── README.md ├── C++ Basic Tutorials ├── Question & Answer │ └── C++ Question & Answer.md ├── Simple Programs │ ├── ARRAY │ │ ├── Double Dimension Array │ │ │ └── Array Program List.md │ │ └── Single Dimension Array │ │ │ └── Array Program List.md │ ├── BASIC │ │ └── Basic Program List.md │ ├── FUNCTION │ │ ├── Function Program List.md │ │ └── String Program List.md │ ├── IF, IF ELSE, NESTED IF │ │ └── If Program List.md │ ├── LOOP │ │ ├── DO WHILE LOOP │ │ │ └── Do While Loop Program List.md │ │ ├── FOR LOOP │ │ │ └── For Loop Program List.md │ │ └── WHILE LOOP │ │ │ └── While Loop Program List.md │ ├── POINTER │ │ └── Pointer Program List.md │ ├── STRUCTURE │ │ ├── Enumeration Program List.md │ │ ├── Structure Program List.md │ │ └── Union Program List.md │ └── SWITCH │ │ └── Switch Program List.md └── Tutorial.md ├── README.md ├── UNIBEN STUDENT └── readme.md └── imgs └── C++ ├── img1.jpg ├── img10.jpg ├── img11.jpg ├── img12.jpg ├── img13.jpg ├── img14.jpg ├── img15.jpg ├── img16.jpg ├── img17.jpg ├── img18.jpg ├── img19.jpg ├── img2.jpg ├── img20.jpg ├── img21.jpg ├── img22.jpg ├── img23.jpg ├── img24.jpg ├── img25.jpg ├── img26.jpg ├── img27.jpg ├── img28.jpg ├── img29.jpg ├── img3.jpg ├── img30.jpg ├── img31.jpg ├── img32.jpg ├── img33.jpg ├── img34.jpg ├── img35.jpg ├── img36.jpg ├── img37.jpg ├── img38.jpg ├── img38b.jpg ├── img39.jpg ├── img4.jpg ├── img40.jpg ├── img41.jpg ├── img42.jpg ├── img5.jpg ├── img6.jpg ├── img7.jpg ├── img8.jpg └── img9.jpg /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Package Files # 4 | *.jar 5 | *.war 6 | 7 | # gwt caches and compiled units # 8 | war/gwt_bree/ 9 | gwt-unitCache/ 10 | 11 | # boilerplate generated classes # 12 | .apt_generated/ 13 | 14 | # more caches and things from deploy # 15 | war/WEB-INF/deploy/ 16 | war/WEB-INF/classes/ 17 | 18 | #compilation logs 19 | .gwt/ 20 | 21 | #gwt junit compilation files 22 | www-test/ 23 | 24 | #old GWT (1.5) created this dir 25 | .gwt-tmp/ 26 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Nemonet The Young Programmer (TYP) 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 | -------------------------------------------------------------------------------- /Projects/C Projects/Advance (GUI)/README.md: -------------------------------------------------------------------------------- 1 | # Advance C Programming Projects (GUI) 2 | 3 | Advance C Programming Projects (GUI) hoes here 4 | -------------------------------------------------------------------------------- /Projects/C Projects/Advance (GUI)/Sci. Calculator (GUI)/README.md: -------------------------------------------------------------------------------- 1 | Scientific Calculator in C programming language (GUI). 2 | 3 | Click here to visit 4 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Avoid Missile/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Avoid Missile 2 | 3 | 🚧🚧 Still Working on this 4 | 5 | In collaboration with @yumjunstar 6 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Avoid Missile/avoid missile.c: -------------------------------------------------------------------------------- 1 | //Arcade Spaceship Game 2 | /* 3 | * © 2021 Junwoo Yeom 4 | * © 2022 Nemonet TYP 5 | */ 6 | #define MAX_COL 120 7 | #define MAX_ROW 30 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | struct Ship_Location {//player 15 | int health; // current health 16 | int x; 17 | int y; 18 | }ship; 19 | 20 | const int max_health = 3; 21 | int score = 0; // current score 22 | int max_score = 0;//highest score 23 | int** background; // save object position obstacle item 24 | int bottom_size = 5;//Size occupied by the bottom display window 25 | int level = 1; // level 26 | 27 | int bottom_explain = 0; //temp variable 28 | 29 | void init(); //initialization function 30 | void gotoxy(int x, int y); // function to move coordinates 31 | void color(int code);//color change function 32 | 33 | void ship_move(); // make the player ship move 34 | void obstacle(int difficulty); //Function to save the missile's position 35 | void cure(int dif); // Function to store the health recovery item position 36 | void object_down(); //Function to move missiles and items 37 | void print_game(); // Function to print the game screen 38 | void bottom(); // Function to display bottom health, score, and highest score 39 | 40 | void clearbottom(); 41 | void reset_arr_1(int* arr, int size, int value);//1 dimensional array initialization function 42 | void reset_arr_2(int** arr, int row, int column, int value); // 2D array initialization function 43 | void print_arr(); // function for debug 44 | int gameover(); // screen when game is over 45 | void load(); //Load the all-time high score 46 | void save(); // Save the highest score 47 | void mainmenu(); // main menu function 48 | 49 | int main(void) { 50 | int delay = 20; 51 | mainmenu(); 52 | do {//do ~ while statement to confirm whether to continue the game 53 | init(); // initial setting 54 | delay = 20; 55 | while (ship.health >= 1) { 56 | 57 | ship_move(); // move the ship 58 | 59 | obstacle(level);//assign and move 60 | cure(2); 61 | object_down(); 62 | 63 | print_game(); 64 | score++; 65 | level = score / 100 + 1; // Level related expressions so that every 100 points rise by one level 66 | 67 | { 68 | if (score >= max_score) {//specify max score 69 | max_score = score; 70 | } 71 | if (20 - score / 100 > 0) { // Decrease the delay 72 | delay = 20 - score / 100; 73 | } 74 | else { // If less than 0, change to delay 1 75 | delay = 1; 76 | } 77 | Sleep(delay); // speed control 78 | } 79 | } 80 | save(); 81 | system("cls"); 82 | } while (gameover() == 1); 83 | 84 | return 0; 85 | } 86 | 87 | void mainmenu() { 88 | system("mode con:cols=100 lines=20"); 89 | system("title main menu"); 90 | gotoxy(50 - 13, 15); 91 | color(7); 92 | printf("Press any key to start the game"); 93 | while (1) { 94 | gotoxy(50 - 10, MAX_ROW / 2 - 9); 95 | color(14); 96 | printf("★Dodge Missile★\n"); 97 | 98 | Sleep(100); 99 | color(3); 100 | gotoxy(50 - 10, MAX_ROW / 2 - 9); 101 | printf("★Dodge Missile★\n"); 102 | Sleep(100); 103 | if (_kbhit()) break; //check if key is pressed 104 | } 105 | } 106 | 107 | void init() { 108 | load(); //Load the highest score 109 | score = 0; // Initialize score 110 | srand(time(NULL)); // set random seed according to time 111 | background = (int**)malloc(sizeof(int*) * MAX_ROW);//background row (save objects in the background except player spaceship) 112 | for (int i = 0; i < MAX_ROW; i++) { 113 | background[i] = (int*)malloc(sizeof(int) * MAX_COL); // background column 114 | } 115 | 116 | ship.health = max_health;//set the ship's initial health 117 | reset_arr_2(background, MAX_ROW, MAX_COL, 0); // reset to 0 118 | ship.x = (MAX_COL - bottom_size) / 2; // Initial x-coordinate of the ship 119 | ship.y = MAX_ROW / 2;//Set the initial y-coordinate of the ship 120 | 121 | char* temp[30]; 122 | sprintf_s(temp, sizeof(temp), "mode con:cols=%d lines=%d", MAX_COL, MAX_ROW); // Function to print string format 123 | system(temp);//Set window size 124 | system("title avoid missile"); 125 | 126 | 127 | gotoxy(0, MAX_ROW - 5);//underscore 128 | color(7); 129 | for (int i = 0; i < MAX_COL; i++) { 130 | printf("─"); 131 | } 132 | bottom(); 133 | clearbottom(); 134 | } 135 | void ship_move() { 136 | if (GetAsyncKeyState(VK_LEFT) || GetAsyncKeyState(0x41)) { // left or a key 137 | if (ship.x > 0) { 138 | gotoxy(ship.x, ship.y); 139 | printf(" ");//Delete the previous afterimage 140 | ship.x--;//move to the left 141 | 142 | } 143 | } 144 | if (GetAsyncKeyState(VK_RIGHT) || GetAsyncKeyState(0x44)) { // right or d key 145 | if (ship.x < MAX_COL - 1) { 146 | gotoxy(ship.x, ship.y); 147 | printf(" "); 148 | ship.x++; 149 | } 150 | } 151 | if (GetAsyncKeyState(VK_UP) || GetAsyncKeyState(0x57)) { // up or w key 152 | if (ship.y > 1) { 153 | gotoxy(ship.x, ship.y); 154 | printf(" "); 155 | ship.y--; 156 | } 157 | } 158 | if (GetAsyncKeyState(VK_DOWN) || GetAsyncKeyState(0x53)) { // up or s-key 159 | if (ship.y < MAX_ROW - bottom_size - 1) { 160 | gotoxy(ship.x, ship.y); 161 | printf(" ");//Clear previous afterimage 162 | ship.y++; 163 | } 164 | } 165 | gotoxy(ship.x, ship.y); 166 | color(11); 167 | printf("A"); 168 | color(7); 169 | } 170 | 171 | void obstacle(int dif) { 172 | if (100 / dif > 0) { // Since it is not divisible by 0 173 | if (score % (100 / dif) == 0) { // more and more obstacles 174 | background[0][ship.x] = -1; // an obstacle that reduces health by -1 175 | } 176 | } 177 | else { 178 | background[0][ship.x] = -1; 179 | } 180 | } 181 | void cure(int dif) { 182 | static int prv_dif = 0; // keep the original shape even when the function is off 183 | int random = 0; // obstacle location 184 | if (level != prv_dif) {//every time the level changes 185 | for (int i = 0; i < dif; i++) { 186 | random = rand() % MAX_COL; 187 | if (background[0][random] == 0) { 188 | background[0][random] = 1; // cure 189 | } 190 | else i--; 191 | } 192 | } 193 | prv_dif = level; 194 | } 195 | void object_down() { 196 | 197 | /* Problem occurs when moving from row to column 198 | If you read one line and go down, the object will be on the next line as well. 199 | By the time the for statement is finished, it will eventually go down all at once. 200 | */ 201 | 202 | // So, use the method of descending one row at a time 203 | int* temp; 204 | for (int i = MAX_ROW - 1; i >= 1; i--) { // all background objects down 205 | reset_arr_1(background[MAX_ROW - 1], MAX_COL, 0); // Initialize the last line to 0 206 | temp = background[i ​​- 1]; 207 | background[i ​​- 1] = background[i]; 208 | background[i] = temp; 209 | } 210 | 211 | if (background[ship.y][ship.x] != 0) {//if missile and ship collide or eat health recovery item 212 | gotoxy(ship.x, ship.y - 1);//Go to the y-coordinate one space above and delete the missile 213 | printf(" "); 214 | 215 | ship.health += background[ship.y][ship.x];//Recover health or take damage. 216 | background[ship.y][ship.x] = 0;//Delete the object at that location from the array. 217 | } 218 | 219 | } 220 | 221 | void print_game() { 222 | gotoxy(0, 0); // move to position 0, 0 223 | for (int i = 0; i < MAX_ROW - bottom_size; i++) { 224 | for (int j = 0; j < MAX_COL; j++) { 225 | if (background[i][j] < 0) {/missile if less than 0 heal if greater than 0 226 | if (i - 1 >= 0 && background[i ​​- 1][j] == 0) { 227 | gotoxy(j, i - 1); 228 | printf(" ");//Delete the previous position of the missile 229 | } 230 | gotoxy(j, i); 231 | printf("M");//missile 232 | if (i == MAX_ROW - bottom_size - 1) { // also clear from the bottom 233 | gotoxy(j, i); 234 | printf(" ");//delete previous position of missile 235 | } 236 | 237 | } 238 | else if (background[i][j] > 0) { 239 | if (i - 1 >= 0 && background[i ​​- 1][j] == 0) { 240 | gotoxy(j, i - 1); 241 | printf(" "); // delete previous position 242 | } 243 | gotoxy(j, i); 244 | color(12); 245 | printf("+");//HealPack 246 | color(7); 247 | if (i == MAX_ROW - bottom_size - 1) { // also clear from the bottom 248 | gotoxy(j, i); 249 | printf(" ");//Delete previous missile position 250 | } 251 | } 252 | } 253 | } 254 | 255 | bottom(); 256 | } 257 | void bottom() { 258 | static int prev_health = 0; // place to store previous health 259 | static int prev_level = 0; 260 | 261 | if (prev_health != ship.health) {// Only when health information is updated, delete the display at the bottom and update 262 | clearbottom(); 263 | }prev_health = ship.health; 264 | 265 | if (prev_level != level) {//only when the level information is updated 266 | gotoxy(0, MAX_ROW - 4); 267 | printf("level %d", level); 268 | } 269 | 270 | if (bottom_explain <= 1) { 271 | printf(" (Move with the arrow keys, avoid the white color. Red is the healing potion.)"); 272 | }bottom_explain++; 273 | 274 | 275 | gotoxy(0, MAX_ROW - 2); 276 | printf("Health: "); 277 | color(4); // dark red 278 | for (int i = 0; i < ship.health; i++) { 279 | printf("♥"); 280 | } 281 | for (int i = 0; i < max_health - ship.health; i++) { 282 | printf("♡"); 283 | } 284 | 285 | 286 | color(7); // white 287 | int a = 0; 288 | if (ship.health - max_health > 0) { 289 | a = ship.health - max_health; 290 | } 291 | else a = 0; 292 | gotoxy(20 + a * 2, MAX_ROW - 2); 293 | printf("Score: "); 294 | color(14); // light yellow 295 | printf("%d", score); 296 | 297 | gotoxy(40 + a * 2, MAX_ROW - 2); 298 | color(7); // white 299 | printf("Highest score: "); 300 | color(14); // light yellow 301 | 302 | printf("%d", max_score); 303 | color(7); // white 304 | 305 | 306 | } 307 | 308 | int gameover() { 309 | int i = 0; 310 | while (1) { 311 | color(12); 312 | printf(" _____ _____ _\n"); 313 | printf("| __ \\ | _ | | |\n"); 314 | printf("| | \\/ __ _ _ __ ___ ___ | | |__ __ ___ _ __ | |\n"); 315 | printf("| | __ / _` || '_ ` _ \\ / _ \\ | | |\\ \\ / / / _ \\| '__| | |\n"); 316 | printf("| |_\\ \\| (_| || | | | | | __/ \\ \\_/ / \\ V / | __/| | |_|\n"); 317 | printf(" \\____/ \\__,_||_| |_| |_| \\___| \\___/ \\_/ \\___||_| (_)\n"); 318 | printf("\n"); 319 | color(7); 320 | printf("Current score: "); 321 | color(14); 322 | printf("%d\n", score); 323 | color(7); 324 | printf("Highest score: "); 325 | color(14); 326 | printf("%d\n", max_score); 327 | color(7); 328 | 329 | printf("\nDo you want to do this again?\n"); 330 | printf("1. Yes\n"); 331 | printf("2. no\n"); 332 | system("pause"); 333 | printf("\nInput:"); 334 | 335 | if (scanf_s("%d", &i) == 0) { 336 | rewind(stdin); 337 | i = 0; 338 | printf("Character input is not allowed.\n"); 339 | Sleep(1000); 340 | } 341 | else if (!(i >= 1 && i <= 2)) { // If any number other than 1 and 2 342 | i = 0; 343 | printf("Please enter a number between 1 and 2.\n"); 344 | Sleep(1000); 345 | } 346 | else { 347 | break; 348 | } 349 | system("cls"); 350 | } 351 | return i; 352 | } 353 | 354 | 355 | void color(int code) { 356 | SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), code); // Function defined in windows.h, standard output handle, set color to number 357 | } 358 | void gotoxy(int x, int y) { 359 | COORD Pos; // Coordinate structure 360 | Pos.X = x; 361 | Pos.Y = y; 362 | SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos); // Function defined in windows.h, standard output handle, coordinates as a structure 363 | } 364 | 365 | void clearbottom() { 366 | gotoxy(0, MAX_ROW - 4); 367 | for (int i = 0; i < MAX_COL; i++) { 368 | printf(" "); 369 | } 370 | gotoxy(0, MAX_ROW - 2); 371 | for (int i = 0; i < MAX_COL; i++) { 372 | printf(" "); 373 | } 374 | } 375 | void reset_arr_2(int** arr, int row, int column, int value) { 376 | for (int i = 0; i < row; i++) { 377 | for (int j = 0; j < column; j++) { 378 | arr[i][j] = value; 379 | } 380 | } 381 | } 382 | void reset_arr_1(int* arr, int size, int value) { 383 | for (int i = 0; i < size; i++) { 384 | arr[i] = value; 385 | } 386 | } 387 | void load() { 388 | FILE* fp; 389 | fopen_s(&fp, ".Game_Info.txt", "a+");//read and append mode 390 | if (fp != NULL) { 391 | fscanf_s(fp, "%d", &max_score); 392 | fclose(fp); 393 | } 394 | else printf("\nFailed to read file\n"); 395 | } 396 | void save() { 397 | FILE* fp; 398 | fopen_s(&fp, ".Game_Info.txt", "w"); 399 | if (fp != NULL) { 400 | fprintf(fp, "%d\n", max_score); // Save the highest score 401 | fclose(fp); 402 | } 403 | else printf("\nFailed to write file\n"); 404 | } 405 | void print_arr() {//for debug 406 | printf("--------------------------------------"); 407 | for (int i = 0; i < MAX_ROW; i++) { 408 | for (int j = 0; j < MAX_COL; j++) { 409 | if (background[i][j] != 0) { 410 | printf("%d", background[i][j]); 411 | } 412 | else { 413 | printf(" "); 414 | } 415 | } 416 | printf("\n"); 417 | } 418 | } 419 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Love-Calculator/Love-Calculator.md: -------------------------------------------------------------------------------- 1 | # Love-Calculator 2 | Its shows Love matches between two different people. 3 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Love-Calculator/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | void enter_string(char* message, char* s, size_t s_size) 6 | { 7 | printf("%s", message); 8 | fgets(s, s_size, stdin); 9 | } 10 | 11 | int get_score(char* s) 12 | { 13 | char *end; 14 | for (end = s; *end != '\0'; ++end); 15 | --end; 16 | 17 | if (end == s) 18 | { 19 | printf("wrong Input\n"); 20 | return -1; 21 | } 22 | 23 | int score = 0; 24 | char c; 25 | for(char* p = s; p != end; ++p) 26 | { 27 | c = *p; 28 | if(c == ' ') continue; 29 | 30 | c &= ~0x20; 31 | 32 | if(c >= 'A' && c <= 'Z') 33 | { 34 | score += c - '@'; 35 | } 36 | else 37 | { 38 | printf("wrong Input\n"); 39 | return -1; 40 | } 41 | } 42 | return score * 5 / (end - s); 43 | } 44 | 45 | int main() 46 | { 47 | int p,s1,s2; 48 | char name[1000]; 49 | 50 | while(1) 51 | { 52 | do 53 | { 54 | enter_string("Enter The First Name: ", name, sizeof(name)); 55 | s1 = get_score(name); 56 | } while (s1 == -1); 57 | 58 | do 59 | { 60 | enter_string("Enter The Second Name: ", name, sizeof(name)); 61 | s2 = get_score(name); 62 | } while (s2 == -1); 63 | 64 | if(s2 > s1) 65 | { 66 | p = (s1 * 100) / s2; 67 | } 68 | else 69 | { 70 | p = (s2 * 100) / s1; 71 | } 72 | 73 | printf("The love Percentage is : %d %% \n",p); 74 | printf("\n pls Follow me 🌟 if you like this code 😊\n"); 75 | } 76 | return 0; 77 | } 78 | 79 | 80 | /* created by NemoNet aka The Young Programmer 🏅 81 | in collaboration with tigertv 🐯 82 | pls kindly follow me on github OR 83 | give me a star 🌟 */ 84 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Modern Periodic Table/DATA: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Projects/C Projects/Basic/Modern Periodic Table/DATA -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Modern Periodic Table/PERIODIC.C: -------------------------------------------------------------------------------- 1 | // Autor : Nemonet TYP 2 | // Title: Modern Periodic Table Project in C 3 | // PROJECT FOR C/C++ PROGRAMMING TUTORIAL 4 | 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | struct element{ 11 | char name[20]; 12 | char sb[5]; 13 | int atm; 14 | float atms; 15 | char block; 16 | char atc[20]; 17 | char prop[250]; 18 | }p,q; 19 | int rw,cl; 20 | FILE*fp; 21 | void add(); 22 | void explor(); 23 | void print(); 24 | void mainscreen(); 25 | void main() 26 | { 27 | int a,i,n,y; 28 | char c,d; 29 | char date1[15],date2[15],string1[20]; 30 | unsigned int tsz; 31 | 32 | clrscr(); 33 | mainscreen(); 34 | label1: 35 | 36 | 37 | textcolor(15); 38 | gotoxy(22,15);textcolor(14); 39 | cprintf("Enter the corresponding no");gotoxy(22,19);textcolor(10); 40 | cprintf("1.Add new Element Information");gotoxy(22,21); 41 | cprintf("2.Explore");gotoxy(22,23); 42 | cprintf("3.Quit");gotoxy(22,25); 43 | // cprintf("4.Delete the records");gotoxy(22,27); 44 | // cprintf("5.Exit from the program");gotoxy(25,30); 45 | fflush(stdin); 46 | d=getch(); 47 | switch(d) 48 | { 49 | case '1': 50 | { 51 | add(); 52 | // getch(); 53 | // print(); 54 | // getch(); 55 | break; 56 | } 57 | case '2': 58 | { 59 | explor(); 60 | break; 61 | 62 | } 63 | case '3': 64 | { 65 | clrscr(); 66 | mainscreen(); 67 | textcolor(14); gotoxy(30,24); 68 | cprintf("THANK U");gotoxy(30,26); 69 | // cprintf("SAVING UR SETTINGS"); gotoxy(30,28); 70 | cprintf("BYE..........."); 71 | getch(); 72 | exit(1); 73 | break; 74 | } 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | default: 83 | { 84 | clrscr(); 85 | mainscreen(); 86 | textcolor(12+128);gotoxy(22,11); 87 | cprintf("Wrong choice");gotoxy(22,13);textcolor(15); 88 | cprintf("Retype choice"); 89 | goto label1; 90 | } 91 | 92 | } 93 | clrscr(); 94 | mainscreen(); 95 | goto label1; 96 | } 97 | void mainscreen() 98 | { 99 | int i,j; 100 | clrscr(); 101 | for(i=2,j=2;i15) 104 | j=2; 105 | 106 | textcolor(j); 107 | gotoxy(i,2); 108 | cprintf("%c",'*'); 109 | gotoxy(i,cl-1); 110 | cprintf("%c",'*'); 111 | i++; 112 | 113 | } 114 | for(i=2,j=2;i15) 117 | j=2; 118 | textcolor(j); 119 | gotoxy(2,i); 120 | cprintf("%c",'*'); 121 | gotoxy(rw-1,i); 122 | cprintf("%c",'*'); 123 | 124 | } 125 | gotoxy(30,4);textcolor(3); 126 | cprintf("Modern Periodic Table"); 127 | gotoxy(37,6);textcolor(6); 128 | cprintf("Digital"); 129 | gotoxy(35,7); textcolor(15); 130 | cprintf("-----------"); 131 | } 132 | void add() 133 | { 134 | char ch; 135 | label1: 136 | clrscr(); 137 | mainscreen(); 138 | gotoxy(15,14);textcolor(10); 139 | cprintf("Enter the Information of Elements:"); 140 | // printf(" %d",l); 141 | gotoxy(15,16); 142 | cprintf("Name:"); 143 | 144 | gotoxy(15,18); 145 | cprintf("Symbol:"); 146 | 147 | gotoxy(15,20); 148 | cprintf("Atomic No: "); 149 | 150 | gotoxy(15,22); 151 | cprintf("Atomic Wt: "); 152 | 153 | gotoxy(15,24); 154 | cprintf("Atomic Config:"); 155 | 156 | gotoxy(15,26); 157 | cprintf("Block:"); 158 | 159 | gotoxy(15,28); 160 | cprintf("Properties:"); 161 | 162 | 163 | textcolor(15); 164 | fflush(stdin); 165 | gotoxy(20,16); 166 | scanf("%[^\n]",p.name); 167 | p.name[0]=toupper(p.name[0]); 168 | 169 | fflush(stdin); 170 | gotoxy(23,18); 171 | scanf("%[^\n]",p.sb); 172 | p.sb[0]=toupper(p.sb[0]); 173 | 174 | fflush(stdin); 175 | gotoxy(25,20); 176 | scanf("%d",&p.atm); 177 | 178 | fflush(stdin); 179 | gotoxy(25,22); 180 | scanf("%f",&p.atms); 181 | 182 | fflush(stdin); 183 | gotoxy(29,24); 184 | scanf("%[^\n]",p.atc); 185 | 186 | fflush(stdin); 187 | gotoxy(21,26); 188 | scanf("%c",&p.block); 189 | p.block=toupper(p.block); 190 | if(p.block!='S'&&p.block!='P'&&p.block!='D'&&p.block!='F') 191 | p.block=' '; 192 | fflush(stdin); 193 | 194 | gotoxy(26,28); 195 | scanf("%[^\n]",p.prop); 196 | p.prop[0]=toupper(p.prop[0]); 197 | 198 | 199 | 200 | /* gotoxy(9,30); 201 | cprintf("(In Short)"); 202 | 203 | gotoxy(5,33); 204 | cprintf("Reff. Specialist no:"); */ 205 | if((fp=fopen("data","ab+"))==NULL) 206 | { 207 | printf("Cannot open the file f1"); 208 | getch(); 209 | exit(1); 210 | } 211 | fwrite(&p,sizeof(p),1,fp); 212 | fclose(fp); 213 | printf("\n\n\n\t\tEnter 'y' for next record(y/n):"); 214 | ch=getch(); 215 | if(ch=='y') 216 | { 217 | goto label1; 218 | } 219 | 220 | // getch(); 221 | } 222 | void explor() 223 | { 224 | char d,c; 225 | FILE *f; 226 | int given_atmic_no,a,i,tsz,n; 227 | float given_atmic_mass; 228 | int flag; 229 | char string[20]; 230 | startofexplore: 231 | clrscr(); 232 | mainscreen(); 233 | label6: 234 | gotoxy(22,15);textcolor(12); 235 | cprintf("Enter the corresponding no");gotoxy(22,19);textcolor(3); 236 | cprintf("1.Search by 'NAME'");gotoxy(22,21); 237 | cprintf("2.Search by SYMBOL");gotoxy(22,23); 238 | cprintf("3.Search by ATOMIC NUMBER");gotoxy(22,25); 239 | cprintf("4.Search by ATOMIC WEIGHT");gotoxy(22,27); 240 | cprintf("5.Elements of Diff. Blocks");gotoxy(22,29); 241 | cprintf("6.Return to main menu"); 242 | gotoxy(25,32); 243 | fflush(stdin); 244 | d=getch(); 245 | switch(d) 246 | { 247 | case '1': 248 | { 249 | clrscr(); 250 | mainscreen(); 251 | gotoxy(15,25); 252 | textcolor(12); 253 | cprintf("Enter the Name of Element:"); 254 | textcolor(3); 255 | fflush(stdin); 256 | scanf("%[^\n]",string); 257 | printf("%s",string); 258 | string[0]=toupper(string[0]); 259 | if((fp=fopen("data","rb+"))==NULL) 260 | { 261 | clrscr(); 262 | 263 | printf("\n cannot open the record file 1"); 264 | getch(); 265 | exit(1); 266 | } 267 | flag=1; 268 | while(fread(&p,sizeof(p),1,fp)) 269 | { 270 | if(strcmp(p.name,string)==0) 271 | { 272 | print(); 273 | 274 | flag=0; 275 | 276 | break; 277 | } 278 | 279 | } 280 | if(flag==1) 281 | { 282 | clrscr(); 283 | mainscreen(); 284 | gotoxy(25,25); 285 | textcolor(12); 286 | cprintf("::No Element Available::"); 287 | 288 | } 289 | 290 | fclose(fp); 291 | getch(); 292 | break; 293 | } 294 | case '2': 295 | { 296 | clrscr(); 297 | mainscreen(); 298 | gotoxy(22,15); 299 | textcolor(12); 300 | cprintf("Enter the symbol:"); 301 | textcolor(3); 302 | fflush(stdin); 303 | scanf("%[^\n]",string); 304 | printf("%s",string); 305 | string[0]=toupper(string[0]); 306 | if((fp=fopen("data","rb+"))==NULL) 307 | { 308 | clrscr(); 309 | 310 | printf("\n cannot open the record file 1"); 311 | getch(); 312 | exit(1); 313 | } 314 | flag=1; 315 | while(fread(&p,sizeof(p),1,fp)) 316 | { 317 | if(strcmp(p.sb,string)==0) 318 | { 319 | print(); 320 | flag=0; 321 | 322 | 323 | break; 324 | } 325 | 326 | } 327 | if(flag==1) 328 | { 329 | clrscr(); 330 | mainscreen(); 331 | gotoxy(25,25); 332 | textcolor(12); 333 | cprintf("::No Element Available::"); 334 | 335 | } 336 | 337 | fclose(fp); 338 | getch(); 339 | break; 340 | } 341 | case '6': 342 | { 343 | return; 344 | } 345 | case '3': 346 | { 347 | clrscr(); 348 | mainscreen(); 349 | gotoxy(15,25); 350 | textcolor(12); 351 | cprintf("Enter the Atomic No. Element:"); 352 | textcolor(3); 353 | fflush(stdin); 354 | scanf("%d",&given_atmic_no); 355 | if((fp=fopen("data","rb+"))==NULL) 356 | { 357 | clrscr(); 358 | 359 | printf("\n cannot open the record file 1"); 360 | getch(); 361 | exit(1); 362 | } 363 | flag=1; 364 | while(fread(&p,sizeof(p),1,fp)) 365 | { 366 | if(p.atm==given_atmic_no) 367 | { 368 | print(); 369 | flag=0; 370 | 371 | break; 372 | } 373 | 374 | } 375 | if(flag==1) 376 | { 377 | clrscr(); 378 | mainscreen(); 379 | gotoxy(25,25); 380 | textcolor(12); 381 | cprintf("::No Element Available::"); 382 | 383 | } 384 | 385 | fclose(fp); 386 | getch(); 387 | break; 388 | } 389 | case '4': 390 | { 391 | clrscr(); 392 | mainscreen(); 393 | gotoxy(15,22); 394 | textcolor(12); 395 | cprintf("Enter the Atomic mass of Element:"); 396 | textcolor(3); 397 | fflush(stdin); 398 | scanf("%f",&given_atmic_mass); 399 | if((fp=fopen("data","rb+"))==NULL) 400 | { 401 | clrscr(); 402 | 403 | printf("\n cannot open the record file 1"); 404 | getch(); 405 | exit(1); 406 | } 407 | flag=1; 408 | while(fread(&p,sizeof(p),1,fp)) 409 | { 410 | if(p.atms==given_atmic_mass) 411 | { 412 | print(); 413 | flag=0; 414 | 415 | break; 416 | } 417 | 418 | } 419 | if(flag==1) 420 | { 421 | clrscr(); 422 | mainscreen(); 423 | gotoxy(25,25); 424 | textcolor(12); 425 | cprintf("::No Element Available::"); 426 | 427 | } 428 | 429 | fclose(fp); 430 | getch(); 431 | break; 432 | } 433 | case '5': 434 | { 435 | 436 | clrscr(); 437 | mainscreen(); 438 | gotoxy(15,25); 439 | textcolor(12); 440 | cprintf("Enter the Block:"); 441 | textcolor(3); 442 | fflush(stdin); 443 | scanf("%c",&c); 444 | c=toupper(c); 445 | if((f=fopen("temp","wb+"))==NULL) 446 | { 447 | clrscr(); 448 | 449 | printf("\n cannot open the temp file 1"); 450 | getch(); 451 | exit(1); 452 | } 453 | 454 | 455 | if((fp=fopen("data","rb+"))==NULL) 456 | { 457 | clrscr(); 458 | 459 | printf("\n cannot open the record file 1"); 460 | getch(); 461 | exit(1); 462 | } 463 | flag=1; 464 | while(fread(&p,sizeof(p),1,fp)) 465 | { 466 | if(p.block==c) 467 | { 468 | fwrite(&p,sizeof(p),1,f); 469 | } 470 | 471 | } 472 | fclose(f); 473 | fclose(fp); 474 | 475 | if((f=fopen("temp","rb+"))==NULL) 476 | { 477 | printf("Cannot open the file"); 478 | getch(); 479 | exit(1); 480 | } 481 | fseek(f,0,SEEK_END); 482 | tsz=ftell(f); 483 | n=(int)(tsz/sizeof(p)); 484 | for(i=0;i<(n-1);i++) 485 | { 486 | for(a=i+1;a0) 493 | { 494 | fseek(f,i*sizeof(p),SEEK_SET); 495 | fwrite(&q,sizeof(p),1,f); 496 | fseek(f,a*sizeof(p),SEEK_SET); fflush(stdin); 497 | fwrite(&p,sizeof(p),1,fp); 498 | } 499 | } 500 | } 501 | rewind(f); 502 | while(fread(&p,sizeof(p),1,f)) 503 | { 504 | 505 | print(); 506 | getch(); 507 | 508 | 509 | } 510 | 511 | 512 | clrscr(); 513 | mainscreen(); 514 | gotoxy(25,25); 515 | textcolor(12); 516 | cprintf("::No Element Available::"); 517 | 518 | 519 | 520 | fclose(f); 521 | getch(); 522 | break; 523 | } 524 | 525 | 526 | default: 527 | { 528 | clrscr(); 529 | mainscreen(); 530 | textcolor(12+128);gotoxy(22,11); 531 | cprintf("Wrong choice");gotoxy(22,13);textcolor(15); 532 | cprintf("Retype choice"); 533 | goto label6; 534 | } 535 | } 536 | goto startofexplore; 537 | 538 | } 539 | void print() 540 | { 541 | clrscr(); 542 | mainscreen(); 543 | gotoxy(15,16); 544 | cprintf("Name:"); 545 | 546 | gotoxy(15,18); 547 | cprintf("Symbol:"); 548 | 549 | gotoxy(15,20); 550 | cprintf("Atomic No: "); 551 | 552 | gotoxy(15,22); 553 | cprintf("Atomic Wt: "); 554 | 555 | gotoxy(15,24); 556 | cprintf("Atomic Config:"); 557 | fflush(stdin); 558 | gotoxy(15,26); 559 | cprintf("Block:"); 560 | 561 | gotoxy(15,28); 562 | cprintf("Properties:"); 563 | 564 | 565 | textcolor(6); 566 | 567 | gotoxy(20,16); 568 | cprintf("%s",p.name); 569 | 570 | gotoxy(23,18); 571 | cprintf("%s",p.sb); 572 | 573 | fflush(stdin); 574 | gotoxy(25,20); 575 | cprintf("%d",p.atm); 576 | 577 | fflush(stdin); 578 | gotoxy(25,22); 579 | cprintf("%f",p.atms); 580 | 581 | fflush(stdin); 582 | gotoxy(29,24); 583 | cprintf("%s",p.atc); 584 | 585 | gotoxy(21,26); 586 | cprintf("%c",p.block); 587 | 588 | gotoxy(26,28); 589 | cprintf("%s",p.prop); 590 | } 591 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Modern Periodic Table/PERIODIC.OBJ: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Projects/C Projects/Basic/Modern Periodic Table/PERIODIC.OBJ -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Modern Periodic Table/README.md: -------------------------------------------------------------------------------- 1 | # Modern Periodic Table in C 2 | 3 | The Modern Periodic Table project is a simple console application built without the use of graphics. 4 | It is developed using the C programming language for the purpose of storing name, symbol, atomic number, atomic weight, and some important properties 5 | as well as to display them as per requirement of the user. 6 | 7 | 8 | ### Purpose : 9 | 10 | This project will help you to understand file handling in C 11 | i.e. creating a file and accessing the stored data in the file, modifying and removing the stored data. 12 | It will also help you to understand the use of functions as well as different parameters of C programming language. 13 | 14 | 15 | ### The main functions used in designing the Modern Periodic Table project are: 16 | 17 | - **void add():** This function is used to input or add the information of new element to the program. 18 | - **void explor():** This function is used to explore the stored information in the file created. 19 | - **void mainscreen():** It is included in source code of project file in order to print the text style and to control its color. 20 | - **void mainscreen():** This function is used to print the main screen or menu of the project. 21 | 22 | 23 | ### The key features of Modern Periodic Table mini project in C are briefly described below: 24 | 25 | - **Storage of Element Information:** In the project, you can add any new element with its name, symbol, atomic number, atomic weight and its some important properties. 26 | When new element information is to be added to this Modern Periodic Table, you have to enter 1 in the main menu and input information in given format. 27 | These information are stored in file created on the hard disk of computer by program itself. 28 | 29 | - **Exploration of element Information:** Another main function of this project is to explore or to display the stored information. 30 | You can search an element by using any of the following method: 31 | - By name of element 32 | - By symbol of element 33 | - By atomic number of element 34 | - By atomic weight of element 35 | 36 | - If you press 3 in the main menu, the program will be terminated. 37 | 38 | 39 | ## Project Output Screens: 40 | 41 | - Welcome Screen 42 | 43 | ![image](https://user-images.githubusercontent.com/79866006/233813855-af98d251-b59c-4310-a36e-bf71a4bf3df1.jpg) 44 | 45 | - Search Element 46 | 47 | ![image](https://user-images.githubusercontent.com/79866006/233813890-0b1aff7d-00cb-4fa2-b814-34281f2999ac.jpg) 48 | 49 | - Element Information 50 | 51 | ![image](https://user-images.githubusercontent.com/79866006/233813926-bfc32526-8ef5-4ad7-8657-b8519d571cdc.jpg) 52 | 53 | 54 | 55 |

56 | INFO 57 |

58 |
59 | Modern Periodic Table in C 60 | 61 |
62 | DEVELOPED BY NEMONET (TYP) 63 | 64 |

65 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO PULL AN ISSUE ***** 66 | 67 |
68 | ***** LEAVE A COMMENT IF YOU LOVE MY WORK ***** 69 | 70 |
71 | ***** PLS FORK TNIS PROJECT FOR MORE PROJECT ***** 72 | 73 |
74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/ReadMe.md: -------------------------------------------------------------------------------- 1 | # C Programming Language Basic Projects 2 | 3 | C Programming Language Basic Projects goes here 4 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Tic Tac Toe Game/README.md: -------------------------------------------------------------------------------- 1 | # Tic Tac Toe Game Development using C 2 | 3 | You have probably played the Tic-Tac-Toe game to pass time during school hours. It’s fun when you play with paper and pencil. Here, we have developed a mini project in C Tic Tac Toe game. 4 | 5 | It is the same noughts and crosses or the Xs and Os, the other names for Tic-Tac-Toe. 6 | 7 | ### Function Used: 8 | 9 | I have divided this project into many functions, and below is a list of those functions. 10 | I have only described the gotoxy function in detail. 11 | Just go through the source code once, and other functions used are simple and easy to understand. 12 | 13 | 14 | - **void menu()** – In this mini project, this function displays the menu or welcome screen of this project. 15 | - **void go(int n)** 16 | - **void start_game()** 17 | - **void check_draw()** 18 | - **void draw_board()** 19 | - **void player_first()** 20 | - **void put_X_O(char ch, int pos)** – This function puts one of the numerical character you input into the respective position in Tic-Tac-Toe. 21 | 22 | `For example:` 23 | if you are playing with X and you input 2, the X will go to first row – second column. 24 | If you want to place X in third row – first column, you have to enter 7. 25 | And, it is similar for the other positions. 26 | 27 | - **void gotoxy (int x, int y)** – You need to understand this function as it is one of the most important one used in Tic Tac Toe in C. 28 | This function allows you to print text in any place of the screen. 29 | 30 | ### Images: 31 | 32 | - Menu 33 | 34 | ![menu](https://user-images.githubusercontent.com/79866006/233813434-7e21db30-c100-4df6-b323-a50a7352a979.png) 35 | 36 | - PPlaying with X 37 | 38 | ![Playing-with-X1](https://user-images.githubusercontent.com/79866006/233813448-d2ff3ac9-f4aa-4680-9497-e8775f0f78e3.png) 39 | 40 | - Game Draw 41 | 42 | ![Game-draw](https://user-images.githubusercontent.com/79866006/233813454-5bb3e78e-350b-42a8-a97d-40becec90079.png) 43 | 44 | 45 | 46 | 47 |

48 | INFO 49 |

50 |
51 | TIC TAC TOE GAME project in C 52 | 53 |
54 | DEVELOPED BY NEMONET (TYP) 55 | 56 |

57 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO PULL AN ISSUE ***** 58 | 59 |
60 | ***** LEAVE A COMMENT IF YOU LOVE MY WORK ***** 61 | 62 |
63 | ***** PLS FORK TNIS PROJECT FOR MORE PROJECT ***** 64 | 65 |
66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /Projects/C Projects/Basic/Tic Tac Toe Game/main.c: -------------------------------------------------------------------------------- 1 | // Autor : Nemonet TYP 2 | // Title: Tic Tac Toe Game project in C 3 | // PROJECT FOR C/C++ PROGRAMMING TUTORIAL 4 | 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int board[10] = {2,2,2,2,2,2,2,2,2,2}; 12 | int turn = 1,flag = 0; 13 | int player,comp; 14 | 15 | void menu(); 16 | void go(int n); 17 | void start_game(); 18 | void check_draw(); 19 | void draw_board(); 20 | void player_first(); 21 | void put_X_O(char ch,int pos); 22 | COORD coord= {0,0}; // this is global variable 23 | //center of axis is set to the top left cornor of the screen 24 | void gotoxy(int x,int y) 25 | { 26 | coord.X=x; 27 | coord.Y=y; 28 | SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord); 29 | } 30 | 31 | void main() 32 | { 33 | system("cls"); 34 | menu(); 35 | getch(); 36 | 37 | } 38 | 39 | void menu() 40 | { 41 | int choice; 42 | system("cls"); 43 | printf("\n--------MENU--------"); 44 | printf("\n1 : Play with X"); 45 | printf("\n2 : Play with O"); 46 | printf("\n3 : Exit"); 47 | printf("\nEnter your choice:>"); 48 | scanf("%d",&choice); 49 | turn = 1; 50 | switch (choice) 51 | { 52 | case 1: 53 | player = 1; 54 | comp = 0; 55 | player_first(); 56 | break; 57 | case 2: 58 | player = 0; 59 | comp = 1; 60 | start_game(); 61 | break; 62 | case 3: 63 | exit(1); 64 | default: 65 | menu(); 66 | } 67 | } 68 | 69 | int make2() 70 | { 71 | if(board[5] == 2) 72 | return 5; 73 | if(board[2] == 2) 74 | return 2; 75 | if(board[4] == 2) 76 | return 4; 77 | if(board[6] == 2) 78 | return 6; 79 | if(board[8] == 2) 80 | return 8; 81 | return 0; 82 | } 83 | 84 | int make4() 85 | { 86 | if(board[1] == 2) 87 | return 1; 88 | if(board[3] == 2) 89 | return 3; 90 | if(board[7] == 2) 91 | return 7; 92 | if(board[9] == 2) 93 | return 9; 94 | return 0; 95 | } 96 | 97 | int posswin(int p) 98 | { 99 | // p==1 then X p==0 then O 100 | int i; 101 | int check_val,pos; 102 | 103 | if(p == 1) 104 | check_val = 18; 105 | else 106 | check_val = 50; 107 | 108 | i = 1; 109 | while(i<=9)//row check 110 | { 111 | if(board[i] * board[i+1] * board[i+2] == check_val) 112 | { 113 | if(board[i] == 2) 114 | return i; 115 | if(board[i+1] == 2) 116 | return i+1; 117 | if(board[i+2] == 2) 118 | return i+2; 119 | } 120 | i+=3; 121 | } 122 | 123 | i = 1; 124 | while(i<=3)//column check 125 | { 126 | if(board[i] * board[i+3] * board[i+6] == check_val) 127 | { 128 | if(board[i] == 2) 129 | return i; 130 | if(board[i+3] == 2) 131 | return i+3; 132 | if(board[i+6] == 2) 133 | return i+6; 134 | } 135 | i++; 136 | } 137 | 138 | if(board[1] * board[5] * board[9] == check_val) 139 | { 140 | if(board[1] == 2) 141 | return 1; 142 | if(board[5] == 2) 143 | return 5; 144 | if(board[9] == 2) 145 | return 9; 146 | } 147 | 148 | if(board[3] * board[5] * board[7] == check_val) 149 | { 150 | if(board[3] == 2) 151 | return 3; 152 | if(board[5] == 2) 153 | return 5; 154 | if(board[7] == 2) 155 | return 7; 156 | } 157 | return 0; 158 | } 159 | 160 | void go(int n) 161 | { 162 | if(turn % 2) 163 | board[n] = 3; 164 | else 165 | board[n] = 5; 166 | turn++; 167 | } 168 | 169 | void player_first() 170 | { 171 | int pos; 172 | 173 | check_draw(); 174 | draw_board(); 175 | gotoxy(30,18); 176 | printf("Your Turn :> "); 177 | scanf("%d",&pos); 178 | 179 | if(board[pos] != 2) 180 | player_first(); 181 | 182 | if(pos == posswin(player)) 183 | { 184 | go(pos); 185 | draw_board(); 186 | gotoxy(30,20); 187 | //textcolor(128+RED); 188 | printf("Player Wins"); 189 | getch(); 190 | exit(0); 191 | } 192 | 193 | go(pos); 194 | draw_board(); 195 | start_game(); 196 | } 197 | 198 | void start_game() 199 | { 200 | // p==1 then X p==0 then O 201 | if(posswin(comp)) 202 | { 203 | go(posswin(comp)); 204 | flag = 1; 205 | } 206 | else if(posswin(player)) 207 | go(posswin(player)); 208 | else if(make2()) 209 | go(make2()); 210 | else 211 | go(make4()); 212 | draw_board(); 213 | 214 | if(flag) 215 | { 216 | gotoxy(30,20); 217 | //textcolor(128+RED); 218 | printf("Computer wins"); 219 | getch(); 220 | } 221 | else 222 | player_first(); 223 | } 224 | 225 | void check_draw() 226 | { 227 | if(turn > 9) 228 | { 229 | gotoxy(30,20); 230 | //textcolor(128+RED); 231 | printf("Game Draw"); 232 | getch(); 233 | exit(0); 234 | } 235 | } 236 | 237 | void draw_board() 238 | { 239 | int j; 240 | 241 | for(j=9; j<17; j++) 242 | { 243 | gotoxy(35,j); 244 | printf("| |"); 245 | } 246 | gotoxy(28,11); 247 | printf("-----------------------"); 248 | gotoxy(28,14); 249 | printf("-----------------------"); 250 | 251 | for(j=1; j<10; j++) 252 | { 253 | if(board[j] == 3) 254 | put_X_O('X',j); 255 | else if(board[j] == 5) 256 | put_X_O('O',j); 257 | } 258 | } 259 | 260 | void put_X_O(char ch,int pos) 261 | { 262 | int m; 263 | int x = 31, y = 10; 264 | 265 | m = pos; 266 | 267 | if(m > 3) 268 | { 269 | while(m > 3) 270 | { 271 | y += 3; 272 | m -= 3; 273 | } 274 | } 275 | if(pos % 3 == 0) 276 | x += 16; 277 | else 278 | { 279 | pos %= 3; 280 | pos--; 281 | while(pos) 282 | { 283 | x+=8; 284 | pos--; 285 | } 286 | } 287 | gotoxy(x,y); 288 | printf("%c",ch); 289 | } 290 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Advance (GUI)/Basic Calculator (GUI)/README.md: -------------------------------------------------------------------------------- 1 |
2 |

3 | Basic Calculator in C++ (GUI) 4 |

5 | 6 | Basic Calculator in C++ (GUI) 7 | 8 | 9 | 10 |

11 |
12 | Basic Calculator in C++ (GUI) is a Calculator that can be used to perform all the basic arithmetical operations viz. addition, subtraction, multiplication and division. 13 | 14 | The calculator has a three dimensional shape, and so do all of its buttons. In other words, it looks like a real world, three-dimensional object rather than a two dimensional shape rendered in a program. 15 |

16 | 17 |

18 | 19 | Features : 20 |

21 | 22 |

23 | 24 | - Addition (+) 25 | - Subtraction (-) 26 | - Multiplication (*) 27 | - Division (/) 28 | 29 |

30 | 31 |

Screenshots :

32 | 33 | 34 | 35 | 36 | 37 | 38 |

How to Download

39 |

download CodeBlocks

40 | 41 | - I will be using Code::Blocks in this Project, which I believe is a good place to start. 42 | - You can find the latest version of Codeblocks at http://www.codeblocks.org/. 43 | - Download the mingw-setup.exe file, which will install the text editor with a compiler. 44 | 45 |

download Project

46 | 47 | - Download the Basic Calculator ZIP file 48 | - run the `main.exe` file by double clicking it 49 | 50 | 51 | 52 |

53 | INFO 54 |

55 |
56 | Basic Calculator in C++ (GUI) 57 | 58 |
59 | DEVELOPED BY The Young Programmer (TYP) 60 | 61 |

62 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO PULL AN ISSUE ***** 63 | 64 |
65 | ***** LEAVE A COMMENT IF YOU LOVE MY WORK ***** 66 | 67 |
68 | ***** PLS FORK TNIS PROJECT FOR MORE PROJECT ***** 69 | 70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Advance (GUI)/README.md: -------------------------------------------------------------------------------- 1 | # Advance C++ Programming Projects (GUI) 2 | Advanced C++ Programming Projects (GUI) hoes here 3 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/A Login and Registration System/LoginAndRegistration.cpp: -------------------------------------------------------------------------------- 1 | // Autor : Nemonet TYP 2 | // Title: A Login and Registration System Programmed in C++ 3 | // PROJECT FOR C/C++ PROGRAMMING TUTORIAL 4 | 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "login.cpp" 15 | using namespace std; 16 | 17 | int main() 18 | { 19 | login userLogin; 20 | string userChoice; 21 | cout << "\t\t\t_____________________________________________\n\n\n"; 22 | cout << "\t\t\t Welcome to the NEMO 2023 Login! \n\n"; 23 | cout << "\t\t\t_________ Menu __________\n\n"; 24 | cout << "\t | Press 1 to LOGIN |" << endl; 25 | cout << "\t | Press 2 to REGISTER |" << endl; 26 | cout << "\t | Press 3 if you forgot PASSWORD |" << endl; 27 | cout << "\t | Press 4 to EXIT |" << endl; 28 | cout << "\n\t\t\t Please Enter your choice: "; 29 | cin >> userChoice; 30 | cout << endl; 31 | 32 | if (userChoice == "1") 33 | { 34 | userLogin.Login(); 35 | main(); 36 | } 37 | else if (userChoice == "2") 38 | { 39 | userLogin.Registration(); 40 | main(); 41 | } 42 | else if (userChoice == "3") 43 | { 44 | userLogin.ForgotPassword(); 45 | main(); 46 | } 47 | else if (userChoice == "4") 48 | { 49 | cout << "\t\t\t Goodbye! \n\n"; 50 | } 51 | else 52 | { 53 | system("cls"); 54 | cout << "\t\t\t Please select from the options above\n"; 55 | main(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/A Login and Registration System/README.md: -------------------------------------------------------------------------------- 1 | # A Login and Registration System Programmed in C++ 2 | 3 | A login and registration system programmed in C++ that utilizes password hashing so nobody but the user is able to see the password. 4 | 5 | ## This program does the following: 6 | 7 | - Allows users to register a username, password, and security question into a database (text file) 8 | - Once registered, the user's password and security question will be hashed and nobody but the user will be able to know their password/security question 9 | - Using the text file, the user can login using their username and password 10 | - Once logged in, the user has a special game they may play 11 | - If a user forgets their password, there is a forget password option for the user which will ask for their username, and if it exists, the security question will be asked for. 12 | If the answer matches with what is in the database, the user will be able to use a new password. 13 | 14 | 15 | 16 | 17 |

18 | INFO 19 |

20 |
21 | A Login and Registration System Programmed in C++ 22 | 23 |
24 | DEVELOPED BY NEMONET (TYP) 25 | 26 |

27 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO PULL AN ISSUE ***** 28 | 29 |
30 | ***** LEAVE A COMMENT IF YOU LOVE MY WORK ***** 31 | 32 |
33 | ***** PLS FORK AND GIVE A STAR IF YOU LIKE THIS PROJECT ***** 34 | 35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/A Login and Registration System/data.txt: -------------------------------------------------------------------------------- 1 | janedoe 1671037691 1373396578 2 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/A Login and Registration System/login.cpp: -------------------------------------------------------------------------------- 1 | // Autor : Nemonet TYP 2 | // Title: A Login and Registration System Programmed in C++ 3 | // PROJECT FOR C/C++ PROGRAMMING TUTORIAL 4 | 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "login.h" 15 | using namespace std; 16 | 17 | void login::Login() 18 | { 19 | string count; 20 | string username, password, id, recordPass, recordSecurity; 21 | system("cls"); 22 | cout << "\n\t\t\t Please enter the username and password: " << endl; 23 | cout << "\t\t\t USERNAME: "; 24 | cin >> username; 25 | cout << "\t\t\t PASSWORD: "; 26 | cin >> password; 27 | 28 | string loginHash = password; 29 | hash mystdhash; 30 | int loginHashPassword = mystdhash(loginHash); 31 | 32 | ifstream input("data.txt"); 33 | 34 | while (input >> id >> recordPass >> recordSecurity) 35 | { 36 | if (id == username && stoi(recordPass) == loginHashPassword) 37 | { 38 | count = "1"; 39 | system("cls"); 40 | } 41 | } 42 | input.close(); 43 | if (count == "1") 44 | { 45 | cout << username << "\nLogin successful!\n"; 46 | string choice = "1"; 47 | while (choice != "2") 48 | { 49 | cout << "\t\t\t_____________________________________________\n\n\n"; 50 | cout << "\t\t\t Welcome to the NEMO 2023 Login! \n\n"; 51 | cout << "\t\t\t_______ Currently Logged In: " << username << " ________\n\n"; 52 | cout << "\t\t\t_________ Menu __________\n\n"; 53 | cout << "\t | Press 1 to PLAY GAME |" << endl; 54 | cout << "\t | Press 2 to LOGOUT |" << endl; 55 | cout << "\n\t\t\t Please Enter your choice: "; 56 | cin >> choice; 57 | cout << endl; 58 | 59 | if (choice == "1") 60 | { 61 | system("cls"); 62 | DrunkGame(); 63 | } 64 | else if (choice == "2") 65 | { 66 | system("cls"); 67 | cout << "Logging out" << endl; 68 | } 69 | else 70 | { 71 | system("cls"); 72 | cout << "Choice invalid, try again"; 73 | } 74 | } 75 | } 76 | else 77 | { 78 | system("cls"); 79 | cout << "\n Username or password is incorrect, please try again or register\n"; 80 | } 81 | } 82 | 83 | void login::Registration() 84 | { 85 | string regUser, regPassword, regId, regPass, securityQuestion, regSecure, regCount; 86 | system("cls"); 87 | cout << "\n\t\t\t Enter Username: "; 88 | cin >> regUser; 89 | cout << "\t\t\t Enter Password: "; 90 | cin >> regPassword; 91 | cout << "\t\t\t Security Question: What was your favorite childhood movie?: "; 92 | cin.ignore(); 93 | getline(cin, securityQuestion); 94 | 95 | string hashing = regPassword; 96 | hash mystdhash; 97 | int hashPassword = mystdhash(hashing); 98 | 99 | string secureHashing = securityQuestion; 100 | hash mystdhash2; 101 | int securityHash = mystdhash2(secureHashing); 102 | 103 | ifstream input("data.txt"); 104 | input.seekg(0, ios::end); 105 | 106 | if (input.tellg() == 0) 107 | { 108 | ofstream f1("data.txt", ios::app); 109 | f1 << regUser << ' ' << hashPassword << ' ' << securityHash << endl; 110 | system("cls"); 111 | cout << "\n\t\t\t Registration successful!\n"; 112 | return; 113 | } 114 | else 115 | { 116 | ifstream input("data.txt"); 117 | while (input >> regId >> regPass >> regSecure) 118 | { 119 | if (regUser == regId) 120 | { 121 | string decision; 122 | cout << "\n\t\tUsername already taken.\n"; 123 | cout << "\t\tEnter 1 to enter a new one\n"; 124 | cout << "\t\tEnter 2 to go back to the menu\n"; 125 | cout << "\n\t\tEnter choice: "; 126 | cin >> decision; 127 | 128 | if (decision == "1") 129 | { 130 | Registration(); 131 | } 132 | else if (decision == "2") 133 | { 134 | system("cls"); 135 | cout << "\tReturning to menu\n"; 136 | return; 137 | } 138 | else 139 | { 140 | system("cls"); 141 | cout << "\tInvalid Entry, returning to menu." << endl; 142 | return; 143 | } 144 | } 145 | else 146 | { 147 | regCount = "1"; 148 | } 149 | } 150 | if (regCount == "1") 151 | { 152 | ofstream f1("data.txt", ios::app); 153 | f1 << regUser << ' ' << hashPassword << ' ' << securityHash << endl; 154 | system("cls"); 155 | cout << "\n\t\t\t Registration successful!\n"; 156 | return; 157 | } 158 | } 159 | } 160 | 161 | void login::DrunkGame() 162 | { 163 | srand(time(0)); 164 | const int size = 60; 165 | cout << "Enter a letter to begin \n "; 166 | char x; 167 | cin >> x; 168 | int position = size / 2; 169 | while (true) 170 | { 171 | cout << "|START|"; 172 | for (int i = 0; i < size; i++) 173 | { 174 | if (i == position) 175 | cout << x; 176 | else 177 | cout << " "; 178 | } 179 | cout << "|END|" << endl; 180 | int move = rand() % 3 - 1; 181 | position = position + move; 182 | if (position < 1) 183 | { 184 | cout << "Guess you were too drunk to make it to the end..." << endl; 185 | break; 186 | } 187 | if (position > size - 1) 188 | { 189 | cout << "You might be drunk, but you made it to the end!" << endl; 190 | break; 191 | } 192 | for (int sleep = 0; sleep < 1000000; ++sleep) 193 | ; 194 | } 195 | system("pause"); 196 | system("cls"); 197 | } 198 | 199 | void login::ForgotPassword() 200 | { 201 | string forgotChoice, count, secondCount; 202 | system("cls"); 203 | cout << "\n\t\t\tPress 1 to enter USERNAME\n"; 204 | cout << "\t\t\tPress 2 to go back to MENU\n"; 205 | cout << "\n\t\t\tEnter choice: "; 206 | cin >> forgotChoice; 207 | 208 | if (forgotChoice == "1") 209 | { 210 | string user, userSecurity, forgotId, forgotPass, forgotSecurity; 211 | int newHashPassword, forgotSecHash; 212 | system("cls"); 213 | cout << "\n\t\tEnter USERNAME: "; 214 | cin >> user; 215 | cout << endl; 216 | 217 | ifstream input("data.txt"); 218 | while (input >> forgotId >> forgotPass >> forgotSecurity) 219 | { 220 | if (user == forgotId) 221 | { 222 | cout << "\n\t\tUser found\n\t\tSecurity Question: What was your favorite childhood movie?: "; 223 | cin.ignore(); 224 | getline(cin, userSecurity); 225 | cout << endl; 226 | 227 | string hashing = userSecurity; 228 | hash mystdhash; 229 | forgotSecHash = mystdhash(hashing); 230 | 231 | if (stoi(forgotSecurity) == forgotSecHash) 232 | { 233 | system("cls"); 234 | string newPass; 235 | cout << "\t\tSecurity Question correct\n"; 236 | cout << "\n\t\tEnter new PASSWORD: "; 237 | cin >> newPass; 238 | 239 | string newPassHash = newPass; 240 | hash mystdhash2; 241 | newHashPassword = mystdhash2(newPassHash); 242 | 243 | count = "1"; 244 | break; 245 | } 246 | else 247 | { 248 | string incorrectChoice; 249 | system("cls"); 250 | cout << "\t\tSecurity Question incorrect\n"; 251 | cout << "\t\tPress 1 to Re-Enter\n\t\tPress 2 to return to MENU\n"; 252 | cout << "\n\t\tEnter choice: "; 253 | cin >> incorrectChoice; 254 | 255 | if (incorrectChoice == "1") 256 | { 257 | ForgotPassword(); 258 | } 259 | if (incorrectChoice == "2") 260 | { 261 | system("cls"); 262 | cout << "\tReturning to MENU\n"; 263 | return; 264 | } 265 | else 266 | { 267 | system("cls"); 268 | cout << "\tInvalid answer... Returning to menu\n"; 269 | return; 270 | } 271 | } 272 | } 273 | else 274 | { 275 | string newChoice; 276 | system("cls"); 277 | cout << "\t\tUser not found\n"; 278 | cout << "\t\tPress 1 to Re-Enter USERNAME\n\t\tPress 2 to return to MENU\n"; 279 | cout << "\n\t\tEnter choice: "; 280 | cin >> newChoice; 281 | if (newChoice == "1") 282 | { 283 | ForgotPassword(); 284 | } 285 | else if (newChoice == "2") 286 | { 287 | system("cls"); 288 | cout << "\tReturning to MENU\n"; 289 | return; 290 | } 291 | else 292 | { 293 | system("cls"); 294 | cout << "\tChoice invalid... Returning to MENU\n"; 295 | return; 296 | } 297 | } 298 | } 299 | input.close(); 300 | if (count == "1") 301 | { 302 | DeleteLine(user); 303 | secondCount = "1"; 304 | } 305 | if (secondCount == "1") 306 | { 307 | ofstream f1("data.txt", ios::app); 308 | f1 << user << ' ' << newHashPassword << ' ' << forgotSecHash << endl; 309 | system("cls"); 310 | cout << "\t\t\t Your password has been updated!\n"; 311 | return; 312 | } 313 | } 314 | else if (forgotChoice == "2") 315 | { 316 | system("cls"); 317 | cout << "\tReturning to MENU\n"; 318 | return; 319 | } 320 | else 321 | { 322 | system("cls"); 323 | cout << "\tChoice invalid... Try again\n"; 324 | ForgotPassword(); 325 | } 326 | } 327 | 328 | void login::DeleteLine(string userDelete) 329 | { 330 | string line; 331 | ifstream myFile; 332 | myFile.open("data.txt"); 333 | ofstream temp; 334 | temp.open("temp.txt"); 335 | while (getline(myFile, line)) 336 | { 337 | if (line.substr(0, userDelete.size()) != userDelete) 338 | { 339 | temp << line << endl; 340 | } 341 | } 342 | myFile.close(); 343 | temp.close(); 344 | remove("data.txt"); 345 | rename("temp.txt", "data.txt"); 346 | } 347 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/A Login and Registration System/login.h: -------------------------------------------------------------------------------- 1 | // Autor : Nemonet TYP 2 | // Title: A Login and Registration System Programmed in C++ 3 | // PROJECT FOR C/C++ PROGRAMMING TUTORIAL 4 | 5 | 6 | #pragma once 7 | #include 8 | using namespace std; 9 | 10 | class login 11 | { 12 | private: 13 | void DrunkGame(); 14 | void DeleteLine(string username); 15 | 16 | public: 17 | void Login(); 18 | void Registration(); 19 | void ForgotPassword(); 20 | }; 21 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/AIO Calculator/AIO calculator.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | //addition 6 | long double add(long double num1, long double num2) 7 | { 8 | long double result; 9 | { 10 | result = num1 + num2; 11 | } 12 | return result; 13 | } 14 | //subtraction 15 | long double sub(long double num1a, long double num2a) 16 | { 17 | long double resulta; 18 | { 19 | resulta = num1a - num2a; 20 | } 21 | return resulta; 22 | } 23 | //multiplication 24 | long double mltp(long double num1b, long double num2b) 25 | { 26 | long double resultb; 27 | { 28 | resultb = num1b * num2b; 29 | } 30 | return resultb; 31 | } 32 | //division 33 | long double dv(long double num1c, long double num2c) 34 | { 35 | long double resultc; 36 | { 37 | resultc = num1c / num2c; 38 | } 39 | return resultc; 40 | } 41 | //exponent 42 | long double power(long double base, long double exponent) 43 | { 44 | long double resultd = 1; 45 | for(long double i = 0; i < exponent; i++) 46 | { 47 | resultd = base * resultd; 48 | } 49 | return resultd; 50 | } 51 | 52 | int panel; 53 | long double a; 54 | long double b; 55 | 56 | void ctrl_panel() 57 | { 58 | cout << "Control Panel\n\nOperators: \n\n1.Addition\n2.Subtraction\n3.Multiplication\n4.Division\n5.Exponent\n6.Multiplication Table\n7.Celcius to Farenheit\n8.Farenheit to Celcius\n\n0.Back\n"; 59 | cin >> panel; 60 | switch(panel) 61 | { 62 | case 0: 63 | return; 64 | break; 65 | case 1: 66 | cout << "Addition\n\nFirst Number: \n"; 67 | cin >> a; 68 | cout << "Second Number: \n"; 69 | cin >> b; 70 | cout << add(a, b) << endl << endl; 71 | break; 72 | case 2: 73 | cout << "Subtraction\n\nFirst Number: \n"; 74 | cin >> a; 75 | cout << "Second Number: \n"; 76 | cin >> b; 77 | cout << sub(a, b) << endl << endl; 78 | break; 79 | case 3: 80 | cout << "Multiplication\n\nFirst Number: \n"; 81 | cin >> a; 82 | cout << "Second Number: \n"; 83 | cin >> b; 84 | cout << mltp(a, b) << endl << endl; 85 | break; 86 | case 4: 87 | cout << "Division\n\nFirst Number: \n"; 88 | cin >> a; 89 | cout << "Second Number: \n"; 90 | cin >> b; 91 | cout << dv(a, b) << endl << endl; 92 | break; 93 | case 5: 94 | cout << "Exponent\n\nBase: \n"; 95 | cin >> a; 96 | cout << "Power: \n"; 97 | cin >> b; 98 | cout << power(a, b) << endl << endl; 99 | break; 100 | case 7: 101 | cout << "Celcius to Farenheit\n\nTemperature: \n"; 102 | cin >> a; 103 | cout << a * 1.8 + 32 << "℉" << endl << endl; 104 | break; 105 | case 8: 106 | cout << "Farenheit to Celcius\n\nTemperature: \n"; 107 | cin >> a; 108 | cout << (a - 32) * 5/9 << "℃" << endl << endl; 109 | break; 110 | case 6: 111 | cout << "Multiplication table\n\nPlease select a number you want to show the table of: \n"; 112 | int num; 113 | cin >> num; 114 | int num2 = 0; 115 | cout << "Range: \n"; 116 | int range; 117 | cin >> range; 118 | 119 | for(int i = 0; i < range; i++) 120 | { 121 | num2++; 122 | cout << num << " x " << num2 << " = " << num * num2 << endl << endl; 123 | } 124 | break; 125 | } 126 | } 127 | 128 | int main() 129 | { 130 | int choice; 131 | do 132 | { 133 | cout << "Welcone to NemoNet Calculator\n\n1.Enter\n0.Quit\n\n"; 134 | cout << " contact NemoNet on: \n\nGitHub\n"; 135 | cin >> choice; 136 | 137 | switch(choice) 138 | { 139 | case 1: 140 | ctrl_panel(); 141 | break; 142 | case 0: 143 | return 0; 144 | break; 145 | } 146 | } 147 | while(choice != 0); 148 | } 149 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/AIO Calculator/README.md: -------------------------------------------------------------------------------- 1 | # AIO-Calculator.cpp -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Bank Management System/README.md: -------------------------------------------------------------------------------- 1 | Bank Management System in C++ 2 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Bank Management System/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/CPP Magic Text/README.md: -------------------------------------------------------------------------------- 1 | # CPP Magic Text 2 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Calculate CGPA and GPA/README.md: -------------------------------------------------------------------------------- 1 | # A C++ program to calculate CGPA and GPA 2 | 3 | As a college student, it’s important to keep track of your academic performance, and one of the key metrics used to measure your progress is your Cumulative Grade Point Average (CGPA). 4 | 5 | 6 | Calculating CGPA can be a time-consuming and complex task, especially if you have taken multiple courses with varying credit load and grading systems. However, with the help of a CGPA calculator, the process can be much simpler and more efficient. 7 | 8 | 9 | 10 |

11 | INFO 12 |

13 |
14 | A C++ program to calculate CGPA and GPA 15 | 16 |
17 | DEVELOPED BY NEMONET (TYP) 18 | 19 |

20 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO PULL AN ISSUE ***** 21 | 22 |
23 | ***** LEAVE A COMMENT IF YOU LOVE MY WORK ***** 24 | 25 |
26 | ***** PLS FORK AND GIVE A STAR IF YOU LIKE THIS PROJECT ***** 27 | 28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Calculate CGPA and GPA/main.cpp: -------------------------------------------------------------------------------- 1 | /*This C++ PROGRAM is developed by NemonET TYP and 2 | special right is given to TEAM TYP for educational purpose */ 3 | //Don't copy source code without permission 4 | 5 | 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | 11 | void calculateGPA(); 12 | void calculateCGPA(); 13 | void method(); 14 | 15 | int main() 16 | { 17 | system("cls"); 18 | int input; 19 | cout<<"--------------------------------------------------------------------------"<>input; 31 | switch(input) 32 | { 33 | case 1: 34 | calculateGPA(); 35 | break; 36 | 37 | case 2: 38 | calculateCGPA(); 39 | break; 40 | case 3: 41 | method(); 42 | break; 43 | case 4: 44 | exit(EXIT_SUCCESS); 45 | break; 46 | default: 47 | cout<<"You have entered wrong input.Try again!\n"<>q; 60 | 61 | float credit [q]; 62 | float point [q]; 63 | 64 | cout<>credit[i]; 69 | cout<>point[i]; 72 | cout<<"-----------------------------------\n\n"<>inmenu; 99 | 100 | switch(inmenu) 101 | { 102 | case 1: 103 | calculateGPA(); 104 | break; 105 | case 2: 106 | main(); 107 | break; 108 | case 3: 109 | exit(EXIT_SUCCESS); 110 | 111 | default: 112 | cout<<"\n\nYou have Entered Wrong Input!Please Choose Again!"<>l; 123 | cout<<"\n\n"<>semrs[i]; 131 | cout<<"\n"<>inmenu; 150 | 151 | switch(inmenu) 152 | { 153 | case 1: 154 | calculateCGPA(); 155 | break; 156 | case 2: 157 | main(); 158 | break; 159 | case 3: 160 | exit(EXIT_SUCCESS); 161 | 162 | default: 163 | cout<<"\n\nYou have Entered Wrong Input!Please Choose Again!"<>inmenu; 183 | 184 | switch(inmenu) 185 | { 186 | case 1: 187 | main(); 188 | break; 189 | case 2: 190 | exit(EXIT_SUCCESS); 191 | 192 | default: 193 | cout<<"\n\nYou have Entered Wrong Input!Please Choose Again!"< 34 | INFO 35 | 36 |
37 | Simple Encryption and Decryption project in C++ 38 | 39 |
40 | DEVELOPED BY NEMONET (TYP) 41 | 42 |

43 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO PULL AN ISSUE ***** 44 | 45 |
46 | ***** LEAVE A COMMENT IF YOU LOVE MY WORK ***** 47 | 48 |
49 | ***** PLS FORK TNIS PROJECT FOR MORE PROJECT ***** 50 | 51 |
52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Encryption and Decryption of Text/main.cpp: -------------------------------------------------------------------------------- 1 | // Autor : Nemonet TYP 2 | // Title: Encryption and Decryption project in C++ 3 | // PROJECT FOR C/C++ PROGRAMMING TUTORIAL 4 | 5 | 6 | #include 7 | using namespace std; 8 | 9 | int main() 10 | { 11 | int i, x; 12 | char str[100]; 13 | 14 | cout << "Please enter a string:\t"; 15 | cin >> str; 16 | 17 | cout << "\nPlease choose following options:\n"; 18 | cout << "1 = Encrypt the string.\n"; 19 | cout << "2 = Decrypt the string.\n"; 20 | cin >> x; 21 | 22 | //using switch case statements 23 | switch(x) 24 | { 25 | //first case for encrypting a string 26 | case 1: 27 | for(i = 0; (i < 100 && str[i] != '\0'); i++) 28 | str[i] = str[i] + 2; //the key for encryption is 3 that is added to ASCII value 29 | 30 | cout << "\nEncrypted string: " << str << endl; 31 | break; 32 | 33 | //second case for decrypting a string 34 | case 2: 35 | for(i = 0; (i < 100 && str[i] != '\0'); i++) 36 | str[i] = str[i] - 2; //the key for encryption is 3 that is subtracted to ASCII value 37 | 38 | cout << "\nDecrypted string: " << str << endl; 39 | break; 40 | 41 | default: 42 | cout << "\nInvalid Input !!!\n"; 43 | } 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Guessing Game/README.md: -------------------------------------------------------------------------------- 1 | # Guessing Game 2 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Guessing Game/text.cpp: -------------------------------------------------------------------------------- 1 | //created by The Young Programmer 🏅aka NemoNet 🖥 2 | 3 | #include 4 | using namespace std; 5 | int main() 6 | { 7 | int attemp = 1,ans,guess=0,_won=0,h=100,l=0; 8 | srand(time(0)); 9 | ans = rand() % 100; 10 | cout<<"**** PLEASE READ INSTRUCTION ****"<>guess; 20 | if(guess < 0 || guess > 100){ 21 | cout<<"INVALID GUESS!!"< "< 2 |

3 | Hotel Booking Management System 4 |

5 | 6 | Hotel Booking Management System in C++ 7 | 8 | 9 | 10 | ![C__Users_Admin_Desktop_main3 exe](https://user-images.githubusercontent.com/79866006/178736172-c6bd256a-61f7-4480-abc9-449384177760.png) 11 | 12 | 13 | 14 | 15 |

16 |

17 | Simple Hotel Management System is based on the concept of managing the hotel room’s bookings and payments. In this system, there are no login features. The user can manage room bookings, customer records, view total allotted rooms, edit records, and make payments. This mini project contains limited but essential features. 18 | 19 |

20 | 21 |

22 | 23 | Features of this C++ language based project : 24 |

25 | 26 |

27 | 28 | - Book Rooms 29 | - View Customer Records 30 | - View rooms allotted 31 | - Edit Records 32 | - Delete Records 33 | - Make Payments 34 | 35 |

36 | 37 |

Screenshots :

38 | 39 | 40 | 41 | 42 | ![C__Users_Admin_Desktop_main exe](https://user-images.githubusercontent.com/79866006/178735392-b2ebb426-4c1a-4454-a60b-ce57a5728873.png) 43 | 44 | 45 | 46 | 47 | 48 | 49 | ![C__Users_Admin_Desktop_main2 exe](https://user-images.githubusercontent.com/79866006/178735893-58009dca-7ff1-4c7d-a579-fe1ae27188df.png) 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |

59 | INFO 60 |

61 |
62 | SIMPLE HOTEL MANAGEMENT SYSTEM IN C++ 63 | 64 |
65 | DEVELOPED BY The Young Programmer (TYP) 66 | 67 |

68 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO PULL AN ISSUE ***** 69 | 70 |
71 | ***** LEAVE A COMMENT IF YOU LOVE MY WORK ***** 72 | 73 |
74 | ***** PLS FORK THIS PROJECT FOR MORE PROJECT ***** 75 | 76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Hotel Management System/Record.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Projects/C++ Projects/Basic/Hotel Management System/Record.dat -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Hotel Management System/main.cpp: -------------------------------------------------------------------------------- 1 | //DEVELOPED BY Nemonet TYP ‍‍‍‍‍‍‍‍‍‍‍‍ 2 | 3 | //C++ PROJECT 4 | 5 | //START OF THE PROGRAM FOR HOTEL MANAGEMENT 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | 16 | //START OF CLASS 17 | 18 | 19 | 20 | class hotel 21 | { 22 | 23 | int room_no; 24 | char name[30]; 25 | char address[50]; 26 | char phone[10]; 27 | 28 | public: 29 | 30 | void main_menu(); //to display the main menu 31 | void add(); //to book a room 32 | void display(); //to display the customer record 33 | void rooms(); //to display alloted rooms 34 | void edit(); //to edit the customer record 35 | int check(int); //to check room status 36 | void modify(int); //to modify the record 37 | void delete_rec(int); //to delete the record 38 | void bill(int); //for the bill of a record 39 | }; 40 | //END OF CLASS 41 | 42 | 43 | 44 | //FOR DISPLAYING MAIN MENU 45 | 46 | 47 | 48 | void hotel::main_menu() 49 | { 50 | 51 | int choice; 52 | while(choice!=5) 53 | { 54 | 55 | system("cls"); 56 | cout<<"\n\t\t\t\t**************************"; 57 | cout<<"\n\t\t\t\t SIMPLE HOTEL MANAGEMENT "; 58 | cout<<"\n\t\t\t\t * MAIN MENU *"; 59 | cout<<"\n\t\t\t\t**************************"; 60 | cout<<"\n\n\n\t\t\t1.Book A Room"; 61 | cout<<"\n\t\t\t2.Customer Records"; 62 | cout<<"\n\t\t\t3.Rooms Allotted"; 63 | cout<<"\n\t\t\t4.Edit Record"; 64 | cout<<"\n\t\t\t5.Exit"; 65 | cout<<"\n\n\t\t\tEnter Your Choice: "; 66 | cin>>choice; 67 | 68 | switch(choice) 69 | { 70 | 71 | case 1: add(); 72 | break; 73 | 74 | case 2: display(); 75 | break; 76 | 77 | case 3: rooms(); 78 | break; 79 | 80 | case 4: edit(); 81 | break; 82 | 83 | case 5: break; 84 | 85 | default: 86 | { 87 | 88 | cout<<"\n\n\t\t\tWrong choice.....!!!"; 89 | cout<<"\n\t\t\tPress any key to continue....!!"; 90 | getch(); 91 | 92 | } 93 | 94 | } 95 | 96 | } 97 | 98 | } 99 | 100 | 101 | //END OF MENU FUNCTION 102 | 103 | 104 | //FUNCTION FOR BOOKING OF ROOM 105 | 106 | 107 | void hotel::add() 108 | { 109 | 110 | system("cls"); 111 | int r,flag; 112 | ofstream fout("Record.dat",ios::app); 113 | 114 | cout<<"\n Enter Customer Detalis"; 115 | cout<<"\n -----------------------"; 116 | cout<<"\n\n Room no: "; 117 | cout<<"\n Total no. of Rooms - 50"; 118 | cout<<"\n Ordinary Rooms from 1 - 30"; 119 | cout<<"\n Luxury Rooms from 31 - 45"; 120 | cout<<"\n Royal Rooms from 46 - 50"; 121 | cout <<"\n Enter The Room no. you want to stay in :- "<<'\n'; 122 | cin>>r; 123 | 124 | flag=check(r); 125 | 126 | if(flag) 127 | cout<<"\n Sorry..!!!Room is already booked"; 128 | 129 | else 130 | { 131 | 132 | room_no=r; 133 | cout<<" Name: "; 134 | cin>>name; 135 | cout<<" Address: "; 136 | cin>>address; 137 | cout<<" Phone No: "; 138 | cin>>phone; 139 | 140 | fout.write((char*)this,sizeof(hotel)); 141 | cout<<"\n Room is booked...!!!"; 142 | 143 | } 144 | 145 | cout<<"\n Press any key to continue.....!!"; 146 | 147 | getch(); 148 | fout.close(); 149 | 150 | } 151 | 152 | 153 | //END OF BOOKING FUNCTION 154 | 155 | 156 | //FUNCTION FOR DISPLAYING A PURTICULAR CUSTOMER`S RECORD 157 | 158 | 159 | 160 | 161 | 162 | void hotel::display() 163 | { 164 | 165 | system("cls"); 166 | 167 | ifstream fin("Record.dat",ios::in); 168 | int r,flag; 169 | 170 | cout<<"\n Enter room No. for a particular customer`s details :- "<<'\n'; 171 | cin>>r; 172 | 173 | while(!fin.eof()) 174 | { 175 | 176 | fin.read((char*)this,sizeof(hotel)); 177 | if(room_no==r) 178 | { 179 | 180 | system("cls"); 181 | cout<<"\n Customer Details"; 182 | cout<<"\n -----------------"; 183 | cout<<"\n\n Room no: "<>choice; 251 | system("cls"); 252 | 253 | cout<<"\n Enter room no: " ; 254 | cin>>r; 255 | 256 | switch(choice) 257 | { 258 | 259 | case 1: modify(r); 260 | break; 261 | 262 | case 2: delete_rec(r); 263 | break; 264 | 265 | case 3: bill(r); 266 | break; 267 | 268 | default: cout<<"\n Wrong Choice.....!!"; 269 | 270 | } 271 | cout<<"\n Press any key to continue....!!!"; 272 | 273 | getch(); 274 | } 275 | 276 | 277 | int hotel::check(int r) 278 | { 279 | 280 | int flag=0; 281 | 282 | ifstream fin("Record.dat",ios::in); 283 | 284 | while(!fin.eof()) 285 | { 286 | 287 | fin.read((char*)this,sizeof(hotel)); 288 | if(room_no==r) 289 | { 290 | 291 | flag=1; 292 | break; 293 | 294 | } 295 | 296 | } 297 | 298 | fin.close(); 299 | return(flag); 300 | 301 | } 302 | 303 | 304 | //FUNCTION TO MODIFY CUSTOMERS RECORD 305 | 306 | 307 | void hotel::modify(int r) 308 | { 309 | 310 | long pos,flag=0; 311 | 312 | fstream file("Record.dat",ios::in|ios::out|ios::binary); 313 | 314 | while(!file.eof()) 315 | { 316 | 317 | pos=file.tellg(); 318 | file.read((char*)this,sizeof(hotel)); 319 | 320 | if(room_no==r) 321 | { 322 | 323 | cout<<"\n Enter New Details"; 324 | cout<<"\n ------------------"; 325 | cout<<"\n Name: "; 326 | cin>>name; 327 | cout<<" Address: "; 328 | cin>>address; 329 | cout<<" Phone no: "; 330 | cin>>phone; 331 | file.seekg(pos); 332 | file.write((char*)this,sizeof(hotel)); 333 | cout<<"\n Record is modified....!!"; 334 | flag=1; 335 | break; 336 | 337 | } 338 | 339 | } 340 | 341 | if(flag==0) 342 | cout<<"\n Sorry Room No. not found or vacant...!!"; 343 | file.close(); 344 | 345 | } 346 | 347 | 348 | //END OF MODIFY FUNCTION 349 | 350 | 351 | //FUNCTION FOR DELETING RECORD 352 | 353 | 354 | void hotel::delete_rec(int r) 355 | { 356 | 357 | int flag=0; 358 | char ch; 359 | ifstream fin("Record.dat",ios::in); 360 | ofstream fout("temp.dat",ios::out); 361 | 362 | while(!fin.eof()) 363 | { 364 | 365 | fin.read((char*)this,sizeof(hotel)); 366 | if(room_no==r) 367 | 368 | { 369 | 370 | cout<<"\n Name: "<>ch; 375 | 376 | if(ch=='n') 377 | fout.write((char*)this,sizeof(hotel)); 378 | flag=1; 379 | 380 | } 381 | 382 | else 383 | fout.write((char*)this,sizeof(hotel)); 384 | 385 | } 386 | 387 | fin.close(); 388 | fout.close(); 389 | 390 | if(flag==0) 391 | cout<<"\n Sorry room No. not found or vacant...!!"; 392 | 393 | else 394 | { 395 | 396 | remove("Record.dat"); 397 | rename("temp.dat","Record.dat"); 398 | 399 | } 400 | 401 | } 402 | 403 | 404 | //END OF DELETE FUNCTION 405 | 406 | 407 | //FUNCTION FOR CUSTOMER`S BILL 408 | 409 | void hotel::bill(int r) 410 | { 411 | 412 | hotel h1; 413 | ifstream f1; 414 | f1.open("record.dat",ios::in|ios::binary); 415 | 416 | if(!f1) 417 | cout<<"cannot open"; 418 | 419 | else 420 | { 421 | 422 | f1.read((char*)&h1,sizeof (hotel)); 423 | while(f1) 424 | 425 | { 426 | 427 | f1.read((char*)&h1,sizeof(hotel)); 428 | 429 | } 430 | 431 | if (h1.room_no == r) 432 | { 433 | 434 | if(h1.room_no>=1&&h1.room_no<=30) 435 | cout<<"your bill = 2000"; 436 | 437 | else if (h1.room_no>=35&&h1.room_no<=45) 438 | cout<<"your bill = 5000" ; 439 | 440 | else 441 | cout<<"your bill = 7000"; 442 | 443 | } 444 | 445 | else 446 | { cout<<"room no. not found";} 447 | 448 | } 449 | 450 | f1.close(); 451 | getch(); 452 | 453 | } 454 | 455 | //END OF BILLING FUNCTION 456 | 457 | //START OF MAIN PROGARM 458 | 459 | 460 | int main() 461 | { 462 | 463 | hotel h; 464 | 465 | system("cls"); 466 | 467 | cout<<"\n\t\t\t*****************************"; 468 | cout<<"\n\t\t\t* HOTEL MANAGEMENT PROJECT *"; 469 | cout<<"\n\t\t\t*****************************"; 470 | cout<<"\n\n\t\tDeveloped By:"; 471 | cout<<"\t\t Nemonet"; 472 | cout<<"\n\t\t\t\t The Young Programmer (TYP)"; 473 | cout<<"\n\n\n\n\n\n\n\t\t\t\t\tPress any key to continue....!!"; 474 | 475 | getch(); 476 | 477 | h.main_menu(); 478 | return 0; 479 | } 480 | 481 | //END OF MAIN PROGRAM 482 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/ReadMe.md: -------------------------------------------------------------------------------- 1 | 2 | # Basic C++ Programming Projects 3 | 4 | This repository contains a collection of basic C++ programming projects aimed at beginners. 5 | 6 | Each project focuses on different aspects of C++ programming and is designed to help you improve your skills and understanding of the language. 7 | 8 | ￶ 9 | 28 | 29 | Feel free to explore these projects, modify them, and enhance them as you progress in your C++ programming journey. 30 | 31 | Each project includes its own set of instructions and code files to help you get started. 32 | 33 | Happy coding! 34 | 35 | ## Getting Started 36 | 37 | To get started with any of the projects, follow the instructions provided in the project readme 38 | 39 | Each project has its own folder containing the source code files, instructions, and any additional resources required. 40 | 41 | ## Contribution 42 | 43 | Contributions to this repository are welcome. If you have any improvements or new project ideas to add, feel free to submit a pull request. 44 | 45 | Please make sure to follow the contribution guidelines outlined in the repository. 46 | 47 | ## License 48 | 49 | This repository is licensed under the [MIT License](LICENSE). You are free to use, modify, and distribute the code as per the terms of the license. 50 | 51 | ## Acknowledgments 52 | 53 | The projects in this repository are inspired by various programming resources, online tutorials, and personal experiences. 54 | 55 | We acknowledge the efforts of the C++ programming community and the valuable learning resources they provide. 56 | 57 | 58 | ## NOTE 59 | 60 | If you have any questions or need assistance with any of the projects, feel free to reach out via the issue tracker. Enjoy learning and coding in C++! 61 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Supermarket Billing System/README.md: -------------------------------------------------------------------------------- 1 | # Supermarket Billing System in C++ 2 | 3 | This supermarket billing system is a simple console application built in C++ without the use of graphics. This project will help you understand basically two things – use of stream class and file handling in c++ programming language. 4 | 5 | ### Listed below are the key features of this project: 6 | 7 | - **Bill Report:** It shows the bill report of all the items added in supermarket billing system. 8 | - **Add, Remove or Edit items:** With this feature you can add, remove and modify item details. In add items, you can add information or details such as item no., item name, manufacturing date, price, quantity, tax percent, and many more. 9 | - **Show item details:** This feature allows users to see the items and the corresponding details given for the item while adding the item. 10 | 11 | 12 | ### Output Screens: 13 | 14 | - Main menu 15 | 16 | ![supermarket-billing-menu](https://user-images.githubusercontent.com/79866006/233812978-2b2a8e4f-9c41-4b16-a8cb-c52061accecb.png) 17 | 18 | - Add items 19 | 20 | ![supermarket-add-items-details](https://user-images.githubusercontent.com/79866006/233812991-6d3cd9b1-48cb-47ef-9079-6944e9ba8ea9.png) 21 | 22 | 23 | 24 | 25 |

26 | INFO 27 |

28 |
29 | Supermarket Billing System in C++ 30 | 31 |
32 | DEVELOPED BY NEMONET (TYP) 33 | 34 |

35 | ***** IF YOU FIND ANY ERRORS OR ANY PROBLEMS RELATED THIS PROGRAM, FEEL FREE TO PULL AN ISSUE ***** 36 | 37 |
38 | ***** LEAVE A COMMENT IF YOU LOVE MY WORK ***** 39 | 40 |
41 | ***** PLS FORK AND GIVE A STAR IF YOU LIKE THIS PROJECT ***** 42 | 43 |
44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Supermarket Billing System/main.cpp: -------------------------------------------------------------------------------- 1 | // Autor : Nemonet TYP 2 | // Title: Supermarket Billing System project in C++ 3 | // PROJECT FOR C/C++ PROGRAMMING TUTORIAL 4 | 5 | 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | using namespace std; 16 | //global variable declaration 17 | int k=7,r=0,flag=0; 18 | COORD coord = {0, 0}; 19 | 20 | void gotoxy(int x, int y) 21 | { 22 | COORD coord; 23 | coord.X = x; 24 | coord.Y = y; 25 | SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); 26 | } 27 | struct date 28 | { 29 | int mm,dd,yy; 30 | }; 31 | 32 | ofstream fout; 33 | ifstream fin; 34 | 35 | class item 36 | { 37 | int itemno; 38 | char name[25]; 39 | date d; 40 | public: 41 | void add() 42 | { 43 | cout<<"\n\n\tItem No: "; 44 | cin>>itemno; 45 | cout<<"\n\n\tName of the item: "; 46 | cin>>name; 47 | //gets(name); 48 | cout<<"\n\n\tManufacturing Date(dd-mm-yy): "; 49 | cin>>d.mm>>d.dd>>d.yy; 50 | } 51 | void show() 52 | { 53 | cout<<"\n\tItem No: "; 54 | cout<>price; 95 | cout<<"\n\n\tQuantity: "; 96 | cin>>qty; 97 | cout<<"\n\n\tTax percent: "; 98 | cin>>tax; 99 | cout<<"\n\n\tDiscount percent: "; 100 | cin>>dis; 101 | calculate(); 102 | fout.write((char *)&amt,sizeof(amt)); 103 | fout.close(); 104 | } 105 | void amount::calculate() 106 | { 107 | gross=price+(price*(tax/100)); 108 | netamt=qty*(gross-(gross*(dis/100))); 109 | } 110 | void amount::show() 111 | { 112 | fin.open("itemstore.dat",ios::binary); 113 | fin.read((char*)&amt,sizeof(amt)); 114 | item::show(); 115 | cout<<"\n\n\tNet amount: "; 116 | cout<>ch; 194 | switch(ch) 195 | { 196 | case 1: 197 | ss: 198 | system("cls"); 199 | gotoxy(25,2); 200 | cout<<"Bill Details"; 201 | gotoxy(25,3); 202 | cout<<"================\n\n"; 203 | cout<<"\n\t\t1.All Items\n\n"; 204 | cout<<"\t\t2.Back to Main menu\n\n"; 205 | cout<<"\t\tPlease Enter Required Option: "; 206 | int cho; 207 | cin>>cho; 208 | if(cho==1) 209 | { 210 | system("cls"); 211 | gotoxy(30,3); 212 | cout<<" BILL DETAILS "; 213 | gotoxy(3,5); 214 | cout<<"ITEM NO"; 215 | gotoxy(13,5); 216 | cout<<"NAME"; 217 | gotoxy(23,5); 218 | cout<<"PRICE"; 219 | gotoxy(33,5); 220 | cout<<"QUANTITY"; 221 | gotoxy(44,5); 222 | cout<<"TAX %"; 223 | gotoxy(52,5); 224 | cout<<"DISCOUNT %"; 225 | gotoxy(64,5); 226 | cout<<"NET AMOUNT"; 227 | fin.open("itemstore.dat",ios::binary); 228 | if(!fin) 229 | { 230 | cout<<"\n\nFile Not Found..."; 231 | goto menu; 232 | } 233 | fin.seekg(0); 234 | gtotal=0; 235 | while(!fin.eof()) 236 | { 237 | fin.read((char*)&amt,sizeof(amt)); 238 | if(!fin.eof()) 239 | { 240 | amt.report(); 241 | gtotal+=amt.retnetamt(); 242 | ff=0; 243 | } 244 | if(ff!=0) gtotal=0; 245 | } 246 | gotoxy(17,k); 247 | cout<<"\n\n\n\t\t\tGrand Total="<>apc; 269 | switch(apc) 270 | { 271 | case 1: 272 | fout.open("itemstore.dat",ios::binary|ios::app); 273 | amt.add(); 274 | cout<<"\n\t\tItem Added Successfully!"; 275 | getch(); 276 | goto db; 277 | 278 | case 2: 279 | int ino; 280 | flag=0; 281 | cout<<"\n\n\tEnter Item Number to be Edited :"; 282 | cin>>ino; 283 | fin.open("itemstore.dat",ios::binary); 284 | fout.open("itemstore.dat",ios::binary|ios::app); 285 | if(!fin) 286 | { 287 | cout<<"\n\nFile Not Found..."; 288 | goto menu; 289 | } 290 | fin.seekg(0); 291 | r=0; 292 | while(!fin.eof()) 293 | { 294 | fin.read((char*)&amt,sizeof(amt)); 295 | if(!fin.eof()) 296 | { 297 | int x=amt.item::retno(); 298 | if(x==ino) 299 | { 300 | flag=1; 301 | fout.seekp(r*sizeof(amt)); 302 | system("cls"); 303 | cout<<"\n\t\tCurrent Details are\n"; 304 | amt.show(); 305 | cout<<"\n\n\t\tEnter New Details\n"; 306 | amt.add(); 307 | cout<<"\n\t\tItem Details editted"; 308 | } 309 | } 310 | r++; 311 | } 312 | if(flag==0) 313 | { 314 | cout<<"\n\t\tItem No does not exist...Please Retry!"; 315 | getch(); 316 | goto db; 317 | } 318 | fin.close(); 319 | getch(); 320 | goto db; 321 | 322 | case 3: 323 | flag=0; 324 | cout<<"\n\n\tEnter Item Number to be deleted :"; 325 | cin>>ino; 326 | fin.open("itemstore.dat",ios::binary); 327 | if(!fin) 328 | { 329 | cout<<"\n\nFile Not Found..."; 330 | goto menu; 331 | } 332 | //fstream tmp("temp.dat",ios::binary|ios::out); 333 | fin.seekg(0); 334 | while(fin.read((char*)&amt, sizeof(amt))) 335 | { 336 | int x=amt.item::retno(); 337 | if(x!=ino) 338 | tmp.write((char*)&amt,sizeof(amt)); 339 | else 340 | { 341 | flag=1; 342 | } 343 | } 344 | fin.close(); 345 | tmp.close(); 346 | fout.open("itemstore.dat",ios::trunc|ios::binary); 347 | fout.seekp(0); 348 | tmp.open("temp.dat",ios::binary|ios::in); 349 | if(!tmp) 350 | { 351 | cout<<"Error in File"; 352 | goto db; 353 | } 354 | while(tmp.read((char*)&amt,sizeof(amt))) 355 | fout.write((char*)&amt,sizeof(amt)); 356 | tmp.close(); 357 | fout.close(); 358 | if(flag==1) 359 | cout<<"\n\t\tItem Succesfully Deleted"; 360 | else if (flag==0) 361 | cout<<"\n\t\tItem does not Exist! Please Retry"; 362 | getch(); 363 | goto db; 364 | case 4: 365 | goto menu; 366 | default: 367 | cout<<"\n\n\t\tWrong Choice!!! Retry"; 368 | getch(); 369 | goto db; 370 | } 371 | case 3: 372 | system("cls"); 373 | flag=0; 374 | int ino; 375 | cout<<"\n\n\t\tEnter Item Number :"; 376 | cin>>ino; 377 | fin.open("itemstore.dat",ios::binary); 378 | if(!fin) 379 | { 380 | cout<<"\n\nFile Not Found...\nProgram Terminated!"; 381 | goto menu; 382 | } 383 | fin.seekg(0); 384 | while(fin.read((char*)&amt,sizeof(amt))) 385 | { 386 | int x=amt.item::retno(); 387 | if(x==ino) 388 | { 389 | amt.pay(); 390 | flag=1; 391 | break; 392 | } 393 | } 394 | if(flag==0) 395 | cout<<"\n\t\tItem does not exist....Please Retry!"; 396 | getch(); 397 | fin.close(); 398 | goto menu; 399 | case 4: 400 | system("cls"); 401 | gotoxy(20,20); 402 | cout<<"ARE YOU SURE, YOU WANT TO EXIT (Y/N)?"; 403 | char yn; 404 | cin>>yn; 405 | if((yn=='Y')||(yn=='y')) 406 | { 407 | gotoxy(12,20); 408 | system("cls"); 409 | cout<<"************************** THANKS **************************************"; 410 | getch(); 411 | exit(0); 412 | } 413 | else if((yn=='N')||(yn=='n')) 414 | goto menu; 415 | else 416 | { 417 | goto menu; 418 | } 419 | default: 420 | cout<<"\n\n\t\tWrong Choice....Please Retry!"; 421 | getch(); 422 | goto menu; 423 | } 424 | return 0; 425 | } 426 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Temperature-calculator/README.md: -------------------------------------------------------------------------------- 1 | # Temperature Calculator 2 | 3 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Temperature-calculator/temperature-calculator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | project status : 1 3 | Date : Oct 11, 2022 4 | Author : Easter Maxwell 5 | co-factor : The Young Programmer Nemonet (Nov 16, 2022) 6 | */ 7 | 8 | /*'Error --1' is just a random error message*/ 9 | 10 | //control number output 11 | #include 12 | 13 | //for system operations 14 | #include 15 | 16 | #include 17 | 18 | using namespace std; 19 | 20 | void standard_output() 21 | { 22 | int fahr; 23 | int order; 24 | int celsius; 25 | int lower_value; 26 | int upper_value; 27 | 28 | cout << '\n'; 29 | cout << "[+]Enter Order value : "; 30 | cin >> order; 31 | 32 | cout << '\n'; 33 | cout << "[+]Enter Lower Value : "; 34 | cin >> lower_value; 35 | 36 | cout << '\n'; 37 | cout << "[+]Enter Upper Value : "; 38 | cin >> upper_value; 39 | 40 | /*enables 'fahr' to start printing from the lowest value*/ 41 | fahr = lower_value; 42 | 43 | cout << '\n'; 44 | cout << "\t\t\t\t\t "; 45 | cout << "--- Temperature ---" << '\n'; 46 | 47 | cout << '\n'; 48 | cout << "\t\t\t\t\t " 49 | << "+----------------------------+" 50 | << '\n' 51 | << "\t\t\t\t\t " 52 | << "| Fahrenheit Celsius |" 53 | << '\n' 54 | << "\t\t\t\t\t " 55 | << "+--------------|-------------+"; 56 | 57 | while (fahr <= upper_value) 58 | { 59 | /*Formula (Fahrenheit to Celsius)*/ 60 | celsius = 5 * (fahr - 32) / 9; 61 | 62 | cout << '\n'; 63 | cout << "\t\t\t\t\t "; 64 | 65 | cout << "| " << fahr << "\t\t " << celsius << " |"; 66 | 67 | cout << '\n'; 68 | cout << "\t\t\t\t\t "; 69 | cout << "+--------------|-------------+"; 70 | 71 | /*increments fahrenheit by the 'order' value*/ 72 | fahr = fahr + order; 73 | } 74 | 75 | } 76 | 77 | void user_specific_output() 78 | { 79 | string option; 80 | float fahr_input; 81 | float fahr_value; 82 | float celsius_input; 83 | float celsius_value; 84 | 85 | cout << "\t\t\t\t\t " 86 | << "--- Available Options ---" << '\n'; 87 | 88 | cout << "\t\t\t " 89 | << '\n' 90 | << "\t\t\t " 91 | << "+-----------------------------------------------------------+" 92 | << "\t\t\t " 93 | << '\n' 94 | << "\t\t\t " 95 | << "| Press F to convert temperature from Fahrenheit to celsius |" 96 | << "\t\t\t " 97 | << '\n' 98 | << "\t\t\t " 99 | << "| --------------------------------------------------------- |" 100 | << "\t\t\t " 101 | << '\n' 102 | << "\t\t\t " 103 | << "| Press C to convert temperature from Celsius to Fahrenheit |" 104 | << "\t\t\t " 105 | << '\n' 106 | << "\t\t\t " 107 | << "+-----------------------------------------------------------+"; 108 | 109 | cout << "\n\n"; 110 | cout << "[:]Enter Option : "; 111 | cin >> option; 112 | 113 | if (option == "C" || option == "c") 114 | { 115 | cout << '\n'; 116 | cout << "[+]Enter Temperature in Celsius : "; 117 | cin >> celsius_input; 118 | 119 | /*Formula (Celsius to Fahrenheit)*/ 120 | fahr_value = (9.0 / 5.0) * celsius_input + 32; 121 | 122 | cout << '\n'; 123 | cout << "\t\t\t\t\t "; 124 | cout << "--- Result ---" << '\n'; 125 | 126 | cout << '\n'; 127 | cout << "\t\t\t\t\t " 128 | << "+----------------------------+" 129 | << '\n' 130 | << "\t\t\t\t\t " 131 | << "| Celsius Fahrenheit |" 132 | << '\n' 133 | << "\t\t\t\t\t " 134 | << "+--------------|-------------+"; 135 | 136 | cout << '\n'; 137 | cout << "\t\t\t\t\t "; 138 | cout << "| " << celsius_input << "\t | " << setprecision(3) << fahr_value << "\t |"; 139 | 140 | cout << '\n'; 141 | cout << "\t\t\t\t\t "; 142 | cout << "+----------------------------+"; 143 | 144 | } 145 | 146 | else if (option == "F" || option == "f") 147 | { 148 | cout << '\n'; 149 | cout << "[+]Enter Temperature in Fahrenheit : "; 150 | cin >> fahr_input; 151 | 152 | /*Formula (Fahrenheit to Celsius)*/ 153 | celsius_value = 5 * (fahr_input - 32) / 9; 154 | 155 | cout << '\n'; 156 | cout << "\t\t\t\t\t "; 157 | cout << "--- Result ---" << '\n'; 158 | 159 | cout << '\n'; 160 | cout << "\t\t\t\t\t " 161 | << "+----------------------------+" 162 | << '\n' 163 | << "\t\t\t\t\t " 164 | << "| Fahrenheit Celsius |" 165 | << '\n' 166 | << "\t\t\t\t\t " 167 | << "+--------------|-------------+"; 168 | 169 | cout << '\n'; 170 | cout << "\t\t\t\t\t "; 171 | cout << "| " << fahr_input << "\t | " << setprecision(3) << celsius_value << "\t |"; 172 | 173 | cout << '\n'; 174 | cout << "\t\t\t\t\t "; 175 | cout << "+----------------------------+"; 176 | } 177 | 178 | else 179 | { 180 | Sleep(500); 181 | cout << "\n[:]#Msg : Error --1" << '\n'; 182 | cout << "[:}Fault : Invalid option Input!" << '\n'; 183 | } 184 | 185 | } 186 | 187 | int main() 188 | { 189 | string user_input; 190 | 191 | cout << "\t\t\t\t\t "; 192 | cout << "--- TEMPERATURE CALCULATOR ---"; 193 | cout << "\n\n"; 194 | cout<<"\n\t\tDeveloped By:"; 195 | cout<<" Easter Maxwell (Oct 11, 2022)"; 196 | cout<<"\n\t\t In Collaboration with:"; 197 | cout<<" Nemonet (TYP) (Nov 16, 2022)"; 198 | cout<<"\n\n\n\n"; 199 | 200 | cout << "\t\t\t\t\t" 201 | << "+------------------------------------+" 202 | << "\t\t\t\t\t" 203 | << '\n' 204 | << "\t\t\t\t\t" 205 | << "| Press 0 to display standard input |" 206 | << "\t\t\t\t\t" 207 | << '\n' 208 | << "\t\t\t\t\t" 209 | << "| ---------------------------------- |" 210 | << "\t\t\t\t\t" 211 | << '\n' 212 | << "\t\t\t\t\t" 213 | << "| Press X to display specific output |" 214 | << "\t\t\t\t\t" 215 | << '\n' 216 | << "\t\t\t\t\t" 217 | << "+------------------------------------+" 218 | << "\n\n"; 219 | 220 | cout << "[:]Enter option : "; 221 | cin >> user_input; 222 | 223 | if (user_input == "0" || user_input == "o" || user_input == "O") 224 | { 225 | Sleep(500); 226 | 227 | /*display this function*/ 228 | standard_output(); 229 | } 230 | 231 | else if (user_input == "X" || user_input == "x" || user_input == "*") 232 | { 233 | Sleep(500); 234 | 235 | /*display this function*/ 236 | user_specific_output(); 237 | } 238 | 239 | else 240 | { 241 | Sleep(500); 242 | cout << "\n[:]#Msg : Error --1" << '\n'; 243 | cout << "[:}Fault : Invalid option Input!" << '\n'; 244 | } 245 | 246 | return 0; 247 | 248 | } 249 | 250 | -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Temperature-calculator/temperature-calculator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Projects/C++ Projects/Basic/Temperature-calculator/temperature-calculator.exe -------------------------------------------------------------------------------- /Projects/C++ Projects/Basic/Temperature-calculator/temperature-calculator.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Projects/C++ Projects/Basic/Temperature-calculator/temperature-calculator.o -------------------------------------------------------------------------------- /Projects/README.md: -------------------------------------------------------------------------------- 1 | # How to Run the Projects 2 | 3 | **NOTE: We will be using Visual Studio Code.** Click here to download Visual Studio Code. 4 |
5 | 6 | ## C/C++ for Visual Studio Code 7 | 8 | C/C++ support for Visual Studio Code is provided by a **Microsoft C/C++ extension** to enable cross-platform C and C++ development on **Windows**, **Linux**, and **macOS**. 9 | 10 | 11 | ![cpp-extension](https://user-images.githubusercontent.com/79866006/232723908-2a3a544c-d8e3-411e-a4e6-a7641849a790.png) 12 | 13 | 14 | 15 | ### Install the extension 16 | 17 | - Open VS Code. 18 | - Select the Extensions view icon on the Activity bar or use the keyboard shortcut (`Ctrl+Shift+X`). 19 | - Search for `C++`. 20 | - Select Install. 21 | - After you install the extension, also search for **Code Runner extension** and install it. 22 | 23 | 24 | ![search-cpp-extension](https://user-images.githubusercontent.com/79866006/232750710-ab0fee4a-5b41-444a-ab63-273b303c2676.png) 25 | 26 | 27 | 28 | 29 | ### Install a compiler 30 | 31 | C++ is a compiled language meaning your program's source code must be translated (compiled) before it can be run on your computer. 32 | 33 | The C/C++ extension does not include a C++ compiler or debugger. You will need to install these tools or use those already installed on your computer. 34 | 35 | Most Linux distributions have the `GNU Compiler Collection (GCC)` installed and macOS users can get the `Clang` tools with `Xcode`. 36 | 37 | #### Check if you have a compiler installed 38 | 39 | - Checking for the GCC compiler `g++`: 40 | 41 | `g++ --version` 42 | 43 | - Checking for the Clang compiler `clang`: 44 | 45 | `clang --version` 46 | 47 | 48 | **If you don't have a compiler installed**, we will describe how to install the Minimalist GNU for Windows (MinGW) C++ tools (compiler and debugger). MinGW is a popular, free toolset for Windows. 49 | 50 | If you are running VS Code on another platform, you can read the vlang/LLVM Compiler and Debugger (For-macOS) , which cover C++ configurations for **Linux** and **macOS**. 51 | 52 | 53 | ### Install MinGW-x64 (For Windows) 54 | 55 | - Follow the Installation instructions on the MSYS2 website to install `Mingw-w64`. 56 | - Make sure to run each required Start menu and `pacman` command. 57 | - Add the MinGW compiler to your path: follow the video below to do that 58 | 59 |
60 | 61 | ### Video Explanation on how to Run the whole process 62 | 63 | https://www.youtube.com/watch?v=7jil6-QRsH0 64 | 65 |
66 | 67 | 68 | #### Check your MinGW installation 69 | 70 | To check that your **Mingw-w64** tools are correctly installed and available, open a new Command Prompt and type: 71 | 72 | `gcc --version` 73 | 74 | `g++ --version` 75 | 76 | `gdb --version` 77 | 78 | If you don't see the expected output or g++ or gdb is not a recognized command, make sure your PATH entry matches the Mingw-w64 binary location where the compiler tools are located. 79 | 80 | **NOTE** 81 | 82 | Follow the video to know How to Install MinGW (MSYS2) and Run C, C++ program in VS Code for Windows 83 | 84 |


85 | 86 | ### PART FOR macOS 87 | 88 |
89 | 90 | ## Install Clang/LLVM compiler and debugger (For macOS) 91 | 92 |
93 | 94 | In this tutorial, you will learn to configure Visual Studio Code on macOS to use the Clang/LLVM compiler and debugger. 95 | 96 | ### Prerequisites 97 | 98 | To successfully complete this tutorial, you must do the following: 99 | 100 | - Install Visual Studio Code on macOS. 101 | 102 | - Install the C++ extension for VS Code. You can install the C/C++ extension by searching for `c++` in the Extensions view (`Ctrl+Shift+X`). 103 | 104 | ![cpp-extension](https://user-images.githubusercontent.com/79866006/233775271-898e189c-a5ea-4053-aeb6-88fc20a19150.png) 105 | 106 | ### Ensure Clang is installed 107 | 108 | - **Clang** may already be installed on your Mac. To verify that it is, open a macOS Terminal window and enter the following command: 109 | 110 | `clang --version` 111 | 112 | - If Clang isn't installed, enter the following command to install the command line developer tools: 113 | 114 | `xcode-select --install` 115 | 116 | ### Video Explanation on how to Run the whole process 117 | 118 | https://www.youtube.com/watch?v=f0vVV4NPmjQ 119 | 120 |
121 | 122 | 123 | 124 | 125 | ## How to Contribute: [🔝](#contents) 126 | 127 | - Just fork the project and clone it into your machine 128 | - Then make your contribution and upload it to your fork repository 129 | - Then click on pull request 130 | 131 |
132 | 133 | ### Donates to Support 134 | 135 | 136 | 137 | **NOTE** 138 | 139 | If you face any issues kindly let us know 140 | -------------------------------------------------------------------------------- /Tutorials/C Basic Tutorials/README.md: -------------------------------------------------------------------------------- 1 | # C Basic Tutorial 2 | 3 | **Note:** This Tutorial is mainly Practical. 4 | 5 |
6 | 7 | Download our mobile App for full Tutorial: 8 | 9 | * App Website: Here 10 | * Play store: Here 11 | * App Store: Here 12 | 13 |
14 | 15 |

16 | 17 | **NoteNote:** 18 | - Give a STAR if you like this 19 | - FORK to get more update 20 | - Make a PULL REQUEST to countribute 21 | 22 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/ARRAY/Double Dimension Array/Array Program List.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/C++ Basic Tutorials/Simple Programs/ARRAY/Double Dimension Array/Array Program List.md -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/ARRAY/Single Dimension Array/Array Program List.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/C++ Basic Tutorials/Simple Programs/ARRAY/Single Dimension Array/Array Program List.md -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/BASIC/Basic Program List.md: -------------------------------------------------------------------------------- 1 | # Basic C++ Program List 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |
9 | 10 | *Put your phone in desktop mode for easy access* 11 | 12 |
13 | 14 | 15 |
16 | 17 |
ADDITION OF TWO NUMBER 18 | 19 | ``` 20 | 21 | #include 22 | using namespace std; 23 | int main() 24 | { 25 | int a,b,c; 26 | cout<<"Enter first number\n"; 27 | cin>>a; 28 | cout<<"Enter second number\n"; 29 | cin>>b; 30 | c=a+b; 31 | cout<<"Add="< 37 | 38 | 39 |
40 | 41 | 42 | 43 |
44 | 45 |
SUBTRACTION OF TWO NUMBER 46 | 47 | ``` 48 | 49 | #include 50 | using namespace std; 51 | int main() 52 | { 53 | int a,b,c; 54 | cout<<"Enter first number\n"; 55 | cin>>a; 56 | cout<<"Enter second number\n"; 57 | cin>>b; 58 | c=a-b; 59 | cout<<"Sub="< 65 | 66 | 67 |
68 | 69 | 70 | 71 |
72 | 73 |
MULTIPLICATION OF TWO NUMBER 74 | 75 | ``` 76 | 77 | #include 78 | using namespace std; 79 | int main() 80 | { 81 | int a,b,c; 82 | cout<<"Enter first number\n"; 83 | cin>>a; 84 | cout<<"Enter second number\n"; 85 | cin>>b; 86 | c=a*b; 87 | cout<<"Multiply="< 93 | 94 | 95 |
96 | 97 | 98 |
99 | 100 |
DIVISION OF TWO NUMBER 101 | 102 | ``` 103 | 104 | #include 105 | using namespace std; 106 | int main() 107 | { 108 | int a,b,c; 109 | cout<<"Enter first number\n"; 110 | cin>>a; 111 | cout<<"Enter second number\n"; 112 | cin>>b; 113 | c=a/b; 114 | cout<<"Div="< 120 | 121 | 122 |
123 | 124 | 125 | 126 | 127 |
128 | 129 |
AREA OF RECTANGLE 130 | 131 | ``` 132 | 133 | #include 134 | using namespace std; 135 | int main() 136 | { 137 | int area,h,w; 138 | cout<<"Enter height of rectangle\n"; 139 | cin>>h; 140 | cout<<"Enter width of rectangle\n"; 141 | cin>>w; 142 | area=h*w; 143 | cout<<"Area of rectangle="< 149 | 150 | 151 |
152 | 153 | 154 | 155 |
156 | 157 |
AREA OF SQUARE 158 | 159 | ``` 160 | 161 | #include 162 | using namespace std; 163 | int main() 164 | { 165 | int area,side; 166 | cout<<"Enter side of square\n"; 167 | cin>>side; 168 | area=side*side; 169 | cout<<"Area of square="< 175 | 176 | 177 |
178 | 179 | 180 | 181 | 182 |
183 | 184 |
AREA OF CIRCLE 185 | 186 | ``` 187 | 188 | #include 189 | using namespace std; 190 | int main() 191 | { 192 | float area,r; 193 | cout<<"Enter radius of circle\n"; 194 | cin>>r; 195 | area=3.14*r*r; 196 | cout<<"Area of circle="< 202 | 203 | 204 |
205 | 206 | 207 | 208 | 209 | 210 |
211 | 212 |
AREA OF TRIANGLE 213 | 214 | ``` 215 | 216 | #include 217 | using namespace std; 218 | int main() 219 | { 220 | float area,b,h; 221 | cout<<"Enter base\n"; 222 | cin>>b; 223 | cout<<"Enter height\n"; 224 | cin>>h; 225 | area=0.5*b*h; 226 | cout<<"Area of triangle="< 232 | 233 | 234 |
235 | 236 | 237 | 238 | 239 |
240 | 241 |
INPUT MARKS OF 5SUBJECT AND FIND THERE AVERAGE 242 | 243 | **Note** Let each subject be Physics=p, Chemistry=c, Math=m, Geography=g, English=e 244 | 245 | ``` 246 | 247 | #include 248 | using namespace std; 249 | int main() 250 | { 251 | float p,c,m,g,e,avg; 252 | cout<<"Enter marks in physics\n"; 253 | cin>>p; 254 | cout<<"Enter marks in chemistry\n"; 255 | cin>>c; 256 | cout<<"Enter marks in math\n"; 257 | cin>>m; 258 | cout<<"Enter marks in geography\n"; 259 | cin>>g; 260 | cout<<"Enter marks in english\n"; 261 | cin>>e; 262 | avg=(p+c+m+g+e)/5; 263 | cout<<"Average of result="< 269 | 270 | 271 |
272 | 273 | 274 | 275 |
276 | 277 |
SIMPLE INTEREST PROGRAM 278 | 279 | ``` 280 | 281 | #include 282 | using namespace std; 283 | int main() 284 | { 285 | float p,r,t,si; 286 | cout<<"Enter principle\n"; 287 | cin>>p; 288 | cout<<"Enter rate of interest\n"; 289 | cin>>r; 290 | cout<<"Enter time\n"; 291 | cin>>t; 292 | si=(p*r*t)/100; 293 | cout<<"Simple Interest="< 299 | 300 | 301 |
302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/FUNCTION/Function Program List.md: -------------------------------------------------------------------------------- 1 | # Function Program List in C++ 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |

9 | 10 | 11 |
12 | 13 |
ADDITION PROGRAM USING FUNCTION 14 | 15 | ``` 16 | 17 | #include 18 | using namespace std; 19 | void add() 20 | { 21 | int x,y=70,z=50; 22 | x=y+z; 23 | cout<<"Add="< 39 | 40 | 41 |
42 | 43 | 44 | 45 |
46 | 47 |
SUBTRACTION PROGRAM USING FUNCTION 48 | 49 | ``` 50 | 51 | #include 52 | using namespace std; 53 | void main() 54 | { 55 | int x,y=70,z=50; 56 | x=y-z; 57 | cout<<"Sub="< 73 | 74 | 75 |
76 | 77 | 78 | 79 |
80 | 81 |
MULTIPLICATION PROGRAM USING FUNCTION 82 | 83 | ``` 84 | 85 | #include 86 | using namespace std; 87 | void () 88 | { 89 | int x,y=70,z=50; 90 | x=y*z; 91 | cout<<"Multiply="< 107 | 108 | 109 |
110 | 111 | 112 | 113 |
114 | 115 |
DIVISION PROGRAM USING FUNCTION 116 | 117 | ``` 118 | 119 | #include 120 | using namespace std; 121 | int main() 122 | { 123 | int x,y=40,z=5; 124 | x=y/z; 125 | cout<<"Div="< 141 | 142 | 143 |
144 | 145 | 146 | 147 |
148 | 149 |
RECTANGLE AREA USING FUNCTION 150 | 151 | ``` 152 | 153 | #include 154 | using namespace std; 155 | void area(int height,int width) 156 | { 157 | int ar=height*width; 158 | cout<<"Area of rectangle="<>h; 165 | cout<<"Enter width\n"; 166 | cin>>w; 167 | area(h,w); 168 | } 169 | 170 | 171 | 172 | /* 173 | ### Output ### 174 | Enter height=20 175 | Enter width=30 176 | 177 | Area of rectangle=600 178 | */ 179 | 180 | ``` 181 | 182 | 183 | 184 | 185 |
186 | 187 | 188 | 189 |
190 | 191 |
CIRCLE AREA USING FUNCTION 192 | 193 | ``` 194 | 195 | #include 196 | using namespace std; 197 | void area(float radius) 198 | { 199 | float ar=3.14*radius*radius; 200 | cout<<"Area of circle="<>r; 207 | area(r); 208 | } 209 | 210 | 211 | /* 212 | ### Output ### 213 | Enter radius of circle=2.2 214 | Area of circle=15.197 215 | */ 216 | 217 | ``` 218 | 219 | 220 | 221 | 222 |
223 | 224 | 225 | 226 | 227 |
228 | 229 |
FUNCTION WITH NO RETURN TYPE AND NO PRAMETER 230 | 231 | ``` 232 | 233 | #include 234 | using namespace std; 235 | void add() 236 | { 237 | int x,y=70,z=50; 238 | x=y+z; 239 | cout<<"Add="< 255 | 256 | 257 |
258 | 259 | 260 | 261 | 262 | 263 |
264 | 265 |
FUNCTION WITH NO RETURN TYPE AND WITH PRAMETER 266 | 267 | ``` 268 | 269 | #include 270 | using namespace std; 271 | void add(int y,int z) 272 | { 273 | int x; 274 | x=y+z; 275 | cout<<"Add="< 291 | 292 | 293 |
294 | 295 | 296 | 297 | 298 |
299 | 300 |
FUNCTION WITH RETURN TYPE AND NO PRAMETER 301 | 302 | ``` 303 | 304 | #include 305 | using namespace std; 306 | void add() 307 | { 308 | int x,y=70,z=50; 309 | x=y+z; 310 | return x; 311 | } 312 | int main() 313 | { 314 | int rs=add(); 315 | cout<<"Add="< 327 | 328 | 329 |
330 | 331 | 332 | 333 |
334 | 335 |
FUNCTION WITH RETURN TYPE AND PRAMETER 336 | 337 | ``` 338 | 339 | #include 340 | using namespace std; 341 | void add(int y,int z) 342 | { 343 | int x; 344 | x=y+z; 345 | return x; 346 | } 347 | int main() 348 | { 349 | int rs=add(10,20); 350 | cout<<"Add="< 362 | 363 | 364 |
365 | 366 | 367 | 368 |
369 | 370 |
CALL BY VALUE 371 | 372 | ``` 373 | 374 | #include 375 | using namespace std; 376 | void add(int y,int z) 377 | { 378 | int x; 379 | x=y+z; 380 | cout<<"Add="< 396 | 397 | 398 |
399 | 400 | 401 | 402 | 403 |
404 | 405 |
CALL BY REFERENCE 406 | 407 | ``` 408 | 409 | #include 410 | using namespace std; 411 | void add(int *y,int *z) 412 | { 413 | int x; 414 | x=*y+*z; 415 | cout<<"Add="< 432 | 433 | 434 |
435 | 436 | 437 | 438 |
439 | 440 |
FUNCTION WITH DEFAULT PARAMETER 441 | 442 | ``` 443 | 444 | #include 445 | using namespace std; 446 | void add(int y=10,int z=20) 447 | { 448 | int x; 449 | x=y+z; 450 | cout<<"Add="< 472 | 473 | 474 |
475 | 476 | 477 | 478 | 479 |
480 | 481 |
PASSING ARRAY TO FUNCTION 482 | 483 | ``` 484 | 485 | #include 486 | using namespace std; 487 | void array(int arr[5]) 488 | { 489 | int sum-0; 490 | cout<<"Element is given below\n"; 491 | for(int i=0;i<=4;i++) 492 | { 493 | cout<>b[i]; 504 | array(b); 505 | } 506 | 507 | 508 | /* 509 | ### Output ### 510 | Enter 5 integer value one by one 511 | 10 512 | 50 513 | 60 514 | 70 515 | 90 516 | Element is given below 517 | 10 50 60 70 90 518 | Total sum=280 519 | */ 520 | 521 | ``` 522 | 523 | 524 | 525 | 526 |
527 | 528 | 529 | 530 | 531 |
532 | 533 |
RECURSSION PROGRAM IN FUNCTION 534 | 535 | ``` 536 | 537 | #include 538 | using namespace std; 539 | void table(int no) 540 | { 541 | if(no!=11) 542 | { 543 | cout< 571 | 572 | 573 |
574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 |


590 | 591 | 592 | **Note:** 593 | - Give a STAR if you like this 594 | - FORK to get more update 595 | - Make a PULL REQUEST to countribute 596 | 597 | 598 | 599 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/FUNCTION/String Program List.md: -------------------------------------------------------------------------------- 1 | # String Program List in C++ 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |

9 | 10 | 11 |
12 | 13 |
CHECK MOBILE NUMBER LENGTH IS CORRECT OR NOT 14 | 15 | ``` 16 | 17 | #include 18 | #include 19 | using namespace std; 20 | int main() 21 | { 22 | char mn[200]; 23 | cout<<"Enter mobile number\n"; 24 | cin>>mn; 25 | if(strlen(mn)==10) 26 | cout<<"\nNumber is correct"; 27 | else 28 | cout<<"\nIncorrect number"; 29 | } 30 | 31 | 32 | /* 33 | ### Output ### 34 | Enter mobile number 35 | 08156622466 36 | 37 | Number is correct 38 | */ 39 | 40 | ``` 41 | 42 | 43 | 44 | 45 |
46 | 47 | 48 | 49 |
50 | 51 |
LOGIN PROGRAM USING STRING 52 | 53 | ``` 54 | 55 | #include 56 | #include 57 | using namespace std; 58 | int main() 59 | { 60 | char u[200]="nemo@net.com",p[200]="nemonet"; 61 | char u1[200].p1[200]; 62 | cout<<"Enter username:\n"; 63 | cin>>u1; 64 | cout<<"Enter password:\n"; 65 | cin>>p1; 66 | if(strcmp(u,u1)==0&&strcmp(p,p1)==0) 67 | cout<<"\nLogin Successfully"; 68 | else 69 | cout<<"\nWrong Username and Password"; 70 | } 71 | 72 | 73 | /* 74 | ### Output ### 75 | Enter username: 76 | nemo@net.com 77 | Enter password: 78 | nemonet 79 | 80 | Login Successfully 81 | */ 82 | 83 | ``` 84 | 85 | 86 | 87 | 88 |
89 | 90 | 91 | 92 |
93 | 94 |
CHECK GIVEN STRING IS PALINDROME OR NOT 95 | 96 | ``` 97 | 98 | #include 99 | #include 100 | using namespace std; 101 | int main() 102 | { 103 | char s[200],cpy[200]; 104 | cout<<"Enter any string:\n"; 105 | gets(s); 106 | strcpy(cpy,s); 107 | strrev(s); 108 | if(strcmp(s,cpy)==0) 109 | cout< 128 | 129 | 130 |
131 | 132 | 133 | 134 |
135 | 136 |
REVERSE STRING WITHOUT USING FUNCTION 137 | 138 | 139 | ``` 140 | 141 | #include 142 | #include 143 | using namespace std; 144 | int main() 145 | { 146 | char s[200]; 147 | int count=0; 148 | cout<<"Enter any string:\n"; 149 | gets(s); 150 | for(int i=0;s[i]!='\0';i++) 151 | count++; 152 | cout<<"Reverse of "<=0;j--) 154 | cout< 169 | 170 | 171 |
172 | 173 | 174 | 175 |
176 | 177 |
FIND LENGTH OF STRING WITHOUT USING FUNCTION 178 | 179 | ``` 180 | 181 | #include 182 | #include 183 | using namespace std; 184 | int main() 185 | { 186 | char s[200]; 187 | int count=0; 188 | cout<<"Enter any string:\n"; 189 | gets(s); 190 | for(int i=0;s[i]!='\0';i++) 191 | count++; 192 | cout<<"Lengt of string is:"< 208 | 209 | 210 |
211 | 212 | 213 | 214 |
215 | 216 |
COUNT ONLY ALPHABELTS IN A STRING 217 | 218 | ``` 219 | 220 | #include 221 | #include 222 | using namespace std; 223 | int main() 224 | { 225 | char s[200]; 226 | int alpha=0; 227 | cout<<"Enter any string:\n"; 228 | gets(s); 229 | for(int i=0;s[i]!='\0';i++) 230 | { 231 | if((s[i]>=65&&s[i]<=90) || (s[i]>=97&&s[i]<=122)) 232 | alpha++; 233 | } 234 | cout<<"Total Alphabelt="< 251 | 252 | 253 |
254 | 255 | 256 | 257 | 258 |
259 | 260 |
COUNT ONLY DIGIT IN A STRING 261 | 262 | ``` 263 | 264 | #include 265 | #include 266 | using namespace std; 267 | int main() 268 | { 269 | char s[200]; 270 | int digit=0; 271 | cout<<"Enter any string:\n"; 272 | gets(s); 273 | for(int i=0;s[i]!='\0';i++) 274 | { 275 | if(s[i]>=48&&s[i]<=57) 276 | } 277 | cout<<"Total Alphabelt="< 294 | 295 | 296 |
297 | 298 | 299 | 300 | 301 | 302 |
303 | 304 |
COUNT ONLY SPECIAL SYMBOL IN A STRING 305 | 306 | ``` 307 | 308 | #include 309 | #include 310 | using namespace std; 311 | int main() 312 | { 313 | char s[200]; 314 | int ss=0; 315 | cout<<"Enter any string:\n"; 316 | gets(s); 317 | for(int i=0;s[i]!='\0';i++) 318 | { 319 | if((s[i]>=65&&s[i]<=90) || (s[i]>=97&&s[i]<=122)) 320 | {} 321 | else if(s[i]>=48&&s[i]<57) 322 | {} 323 | else 324 | ss++; 325 | } 326 | cout<<"Total Special Symbol ="< 341 | 342 | 343 |
344 | 345 | 346 | 347 | 348 |
349 | 350 |
COUNT TOTAL NUMBER SPACE IN A SENTENCE 351 | 352 | ``` 353 | 354 | #include 355 | #include 356 | using namespace std; 357 | int main() 358 | { 359 | char s[200]; 360 | int space=0; 361 | cout<<"Enter any string:\n"; 362 | gets(s); 363 | for(int i=0;s[i]!='\0';i++) 364 | { 365 | if(s[i]=='') 366 | space++; 367 | } 368 | cout<<"Total space in this sentence ="< 383 | 384 | 385 |
386 | 387 | 388 | 389 |
390 | 391 |
COUNT NUMBER OF VOWEL AND CONSONENT IN A STRING 392 | 393 | ``` 394 | 395 | #include 396 | #include 397 | using namespace std; 398 | int main() 399 | { 400 | char s[200]; 401 | int vowel=0,constant=0; 402 | cout<<"Enter any string\n"; 403 | gets(s); 404 | for(int i=0;s[i]!='\0';i++) 405 | { 406 | if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U') 407 | vowel++; 408 | else 409 | consonent++; 410 | } 411 | cout<<"\nTotal Vowel="<>f; 24 | cout<<"Enter second number\n"; 25 | cin>>s; 26 | if(f>s) 27 | cout<<"First number is greater"; 28 | if(f ### Output Img ### 37 | 38 | 39 |
40 | 41 | 42 | 43 | 44 |
45 | 46 |
GREATER VALUE IN 3 NUMBER 47 | 48 | ``` 49 | 50 | #include 51 | using namespace std; 52 | int main() 53 | { 54 | int a,b,c; 55 | cout<<"Enter first number\n"; 56 | cin>>a; 57 | cout<<"Enter second number\n"; 58 | cin>>b; 59 | cout<<"Enter third number\n"; 60 | cin>>c; 61 | if(a>b&&a>c) 62 | cout<a&&b>c) 64 | cout<a&&c>b) 66 | cout< ### Output Img ### 72 | 73 | 74 |
75 | 76 | 77 | 78 | 79 | 80 |
81 | 82 |
CHECK IF A NUMBER IS +ve or -ve or 0 83 | 84 | ``` 85 | 86 | #include 87 | using namespace std; 88 | int main() 89 | { 90 | int no; 91 | cout<<"Enter any number\n"; 92 | cin>>no; 93 | if(no>0) 94 | cout< ### Output Img ### 104 | 105 | 106 |
107 | 108 | 109 | 110 | 111 |
112 | 113 |
SHOW RESULT ACCORDING TO PEERCENT 114 | 115 | ``` 116 | 117 | #include 118 | using namespace std; 119 | int main() 120 | { 121 | float p; 122 | cout<<"Enter your percent\n"; 123 | cin>>p; 124 | if(p<=100&&p>=80) 125 | cout<<"First class"; 126 | if(p<80&&p>=65) 127 | cout<<"Second class upper"; 128 | if(p<65&&p>=55) 129 | cout<<"Second class lower"; 130 | if(p<55&&p>=45) 131 | cout<<"Pass"; 132 | if(p<45) 133 | cout<<"Fail"; 134 | } 135 | 136 | ``` 137 | 138 | ### Output Img ### 139 | 140 | 141 |
142 | 143 | 144 | 145 |
146 | 147 |
EVEN ODD PROGRAM 148 | 149 | ``` 150 | 151 | #include 152 | using namespace std; 153 | int main() 154 | { 155 | int no; 156 | cout<<"Enter any number\n"; 157 | cin>>no; 158 | if(no%2==0) 159 | { 160 | cout<<"Even"; 161 | } 162 | else 163 | { 164 | cout<<"Odd"; 165 | } 166 | } 167 | 168 | ``` 169 | 170 | ### Output Img ### 171 | 172 | 173 |
174 | 175 | 176 | 177 |
178 | 179 |
VOTING PROGRAM 180 | 181 | ``` 182 | 183 | #include 184 | using namespace std; 185 | int main() 186 | { 187 | int age; 188 | cout<<"Enter your age\n"; 189 | cin>>age; 190 | if(age>18) 191 | { 192 | cout<<"You're eligible for voting"; 193 | } 194 | else 195 | { 196 | cout<<"You're not eligible for voting"; 197 | } 198 | } 199 | 200 | ``` 201 | 202 | ### Output Img ### 203 | 204 | 205 |
206 | 207 | 208 | 209 | 210 |
211 | 212 |
CONSTANT OR VOWEL PROGRAM 213 | 214 | ``` 215 | 216 | #include 217 | using namespace std; 218 | int main() 219 | { 220 | char ch; 221 | cout<<"Enter any alphabet\n"; 222 | cin>>ch; 223 | if(ch=='a'||ch=='e'|ch=='i'|ch=='o'|ch=='u') 224 | { 225 | cout<<"Vowel"; 226 | } 227 | else 228 | { 229 | cout<<"Constant"; 230 | } 231 | } 232 | 233 | ``` 234 | 235 | ### Output Img ### 236 | 237 | 238 |
239 | 240 | 241 | 242 | 243 |
244 | 245 |
AREA OF SQUARE 246 | 247 | ``` 248 | 249 | #include 250 | using namespace std; 251 | int main() 252 | { 253 | char u[200]="nemo@net.com",p[200]="nemonet"; 254 | char u1[200],p1=[200]; 255 | cout<<"Enter username\n"; 256 | cin>>u1; 257 | cout<<"Enter password\n"; 258 | cin>>p1; 259 | if(strcmp(u,u1)==0&&strcmp(p,p1)==0) 260 | { 261 | cout<<"Login Successful"; 262 | } 263 | else 264 | { 265 | cout<<"Wrong username or password"; 266 | } 267 | } 268 | 269 | ``` 270 | 271 | ### Output Img ### 272 | 273 | 274 |
275 | 276 | 277 | 278 | 279 |
280 | 281 |
CHECK ALPHABET IS UPPERCASE OR LOWEWRCASE 282 | 283 | ``` 284 | 285 | #include 286 | using namespace std; 287 | int main() 288 | { 289 | char ch; 290 | cout<<"Enter any alphabet\n"; 291 | cin>>ch; 292 | if(ch>=65&&ch<=90) 293 | { 294 | cout<<"Uppercase"; 295 | } 296 | else 297 | { 298 | cout<<"Lowercase"; 299 | } 300 | } 301 | 302 | ``` 303 | 304 | ### Output Img ### 305 | 306 | 307 |
308 | 309 | 310 | 311 | 312 | 313 |
314 | 315 |
CHECK IF A TRIANGLE IS VALID OR NOT 316 | 317 | ``` 318 | 319 | #include 320 | using namespace std; 321 | int main() 322 | { 323 | float a1,a2,a3; 324 | cout<<"Enter first angle\n"; 325 | cin>>a1; 326 | cout<<"Enter second angle\n"; 327 | cin>>a2; 328 | cout<<"Enter third angle\n"; 329 | cin>>a3; 330 | if((a1+a2+a3)==180) 331 | { 332 | cout<<"Triangle is valid"; 333 | } 334 | else 335 | { 336 | cout<<"Triangle is not valid"; 337 | } 338 | } 339 | 340 | ``` 341 | 342 | ### Output Img ### 343 | 344 | 345 |
346 | 347 | 348 | 349 | 350 |
351 | 352 |
CALCULATE PROFIT AND LOSS 353 | 354 | ``` 355 | 356 | #include 357 | using namespace std; 358 | int main() 359 | { 360 | float sp,cp,profit,loss; 361 | cout<<"Enter cost price\n"; 362 | cin>>cp; 363 | cout<<"Enter selling price\n"; 364 | cin>>sp; 365 | if(sp>cp) 366 | { 367 | profit=sp-cp; 368 | cout<<"Profit of "< ### Output Img ### 381 | 382 | 383 |
384 | 385 | 386 | 387 |
388 | 389 |
SHOW RESULT ACCORDING TO PERCENT USING IF ELSE 390 | 391 | ``` 392 | 393 | #include 394 | using namespace std; 395 | int main() 396 | { 397 | float p; 398 | cout<<"Enter your percent\n"; 399 | cin>>p; 400 | if(p>=60) 401 | cout<<"First division"; 402 | else if(p>=45) 403 | cout<<"Second division"; 404 | else if(p>=33) 405 | cout<<"Third division"; 406 | else 407 | cout<<"Fail"; 408 | } 409 | 410 | ``` 411 | 412 | ### Output Img ### 413 | 414 | 415 |
416 | 417 | 418 | 419 | 420 |
421 | 422 |
GREATER VALUE IN 3 NUMBER USING IF ELSE STATEMENT 423 | 424 | ``` 425 | 426 | #include 427 | using namespace std; 428 | int main() 429 | { 430 | int a,b,c; 431 | cout<<"Enter first number\n"; 432 | cin>>a; 433 | cout<<"Enter second number\n"; 434 | cin>>b; 435 | cout<<"Enter third number\n"; 436 | cin>>c; 437 | if(a>b&&a>c) 438 | cout<a&&b>c) 440 | cout< ### Output Img ### 448 | 449 | 450 |
451 | 452 | 453 | 454 | 455 | 456 |
457 | 458 |
CHECK IF CHARACTER IS ALPHABET OR DIGIT OR SPECIAL SYMBOL 459 | 460 | ``` 461 | 462 | #include 463 | using namespace std; 464 | int main() 465 | { 466 | char ch; 467 | cout<<"Enter any chracter\n"; 468 | cin>>ch; 469 | if(ch>=65&&ch<=90||ch>=97&&ch<=122) 470 | cout<<"It is Alphabet"; 471 | else if(ch>=48&&ch<=57) 472 | cout<<"It is Digit"; 473 | else 474 | cout<<"It is Special symbol"; 475 | } 476 | 477 | ``` 478 | 479 | ### Output Img ### 480 | 481 | 482 |
483 | 484 | 485 | 486 | 487 | 488 |
489 | 490 |
CONVERT UPPERCASE INTO LOWERCASE AND LOWERCASE INTO UPPERCASE 491 | 492 | ``` 493 | 494 | #include 495 | using namespace std; 496 | int main() 497 | { 498 | char ch; 499 | cout<<"Enter any alphabet\n"; 500 | cin>>ch; 501 | if(ch>=65&&ch<=97) 502 | cout<<(char)(ch+32); 503 | else 504 | cout<<(char)(ch-32); 505 | } 506 | 507 | ``` 508 | 509 | ### Output Img ### 510 | 511 | 512 |
513 |
514 | 515 | 516 | 517 | 518 |

519 | 520 | **NoteNote:** 521 | - Give a STAR if you like this 522 | - FORK to get more update 523 | - Make a PULL REQUEST to countribute 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/LOOP/DO WHILE LOOP/Do While Loop Program List.md: -------------------------------------------------------------------------------- 1 | # Do While Loop Program List 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |
9 | 10 | *Put your phone in desktop mode for easy access* 11 | 12 |
13 | 14 | 15 |
16 | 17 |
TABLE OF ONE 18 | 19 | ``` 20 | 21 | #include 22 | using namespace std; 23 | int main() 24 | { 25 | int i=1; 26 | do 27 | { 28 | printf("%d\n",i); 29 | i++; 30 | } 31 | while(i<=10); 32 | } 33 | 34 | 35 | /* 36 | ### Output ### 37 | 1 38 | 2 39 | 3 40 | 4 41 | 5 42 | 6 43 | 7 44 | 8 45 | 9 46 | 10 47 | */ 48 | 49 | ``` 50 | 51 | 52 | 53 | 54 |
55 | 56 | 57 | 58 |
59 | 60 |
PRINT DIGITS OF INTEGER VALUE IN REVERSE ORDER 61 | 62 | ``` 63 | 64 | #include 65 | using namespace std; 66 | int main() 67 | { 68 | int no,b; 69 | cout<<"Enter any number\n"; 70 | cin>>no; 71 | cout<<"Revere is given below\n"; 72 | do 73 | { 74 | b=no%10; 75 | cout< 93 | 94 | 95 |
96 | 97 | 98 | 99 |
100 | 101 |
CHECK NUMBER IS PALINDROME OR NOT 102 | 103 | ``` 104 | 105 | #include 106 | using namespace std; 107 | int main() 108 | { 109 | int no,b,rev=0,cpy; 110 | cout<<"Enter any number\n"; 111 | cin>>no; 112 | cpy=no; 113 | do 114 | { 115 | b=no%10; 116 | rev=rev*10+b; 117 | no=no/10; 118 | } 119 | while(no!=0) 120 | if(cpy==rev) 121 | cout<<"Palindrome"; 122 | else 123 | cout<<"Not Palindrome"; 124 | } 125 | 126 | 127 | /* 128 | ### Output ### 129 | Enter any number 130 | 5885 131 | Palindrome 132 | */ 133 | 134 | ``` 135 | 136 | 137 | 138 | 139 |
140 | 141 | 142 |
143 | 144 |
FIND SUM OF DIGITS OF INTEGER VALUE 145 | 146 | ``` 147 | 148 | #include 149 | using namespace std; 150 | int main() 151 | { 152 | int no,b,sum=0; 153 | cout<<"Enter any number\n"; 154 | cin>>no; 155 | do 156 | { 157 | b=no%10; 158 | sum=sum+b; 159 | no=no/10; 160 | } 161 | while(no!=0); 162 | cout<<"Total sum of digits="< 176 | 177 | 178 |
179 | 180 | 181 | 182 |
183 | 184 |
MULTIPLY OF DIGITS OF INTEGER NUMBER 185 | 186 | ``` 187 | 188 | #include 189 | using namespace std; 190 | int main() 191 | { 192 | int no,b,m=1; 193 | cout<<"Enter any number\n"; 194 | cin>>no; 195 | do 196 | { 197 | b=no%10; 198 | m=m*b; 199 | no=no/10; 200 | } 201 | while(no!=0) 202 | cout<<"Total multiply of digits="< 216 | 217 | 218 |
219 | 220 | 221 | 222 | 223 |
224 | 225 |
PRINT FIRST AND LAST DIGIT OF INTEGER NUMBER 226 | 227 | ``` 228 | 229 | #include 230 | using namespace std; 231 | int main() 232 | { 233 | int no,b,f; 234 | cout<<"Enter any number\n"; 235 | cin>>no; 236 | last=no%10; 237 | do 238 | { 239 | b=no%10; 240 | no=no/10; 241 | } 242 | while(no!=0); 243 | cout<<"First digit="<>no; 277 | copy=no; 278 | do 279 | { 280 | b=no%10; 281 | sum=sum+(b*b*b); 282 | no=no/10; 283 | } 284 | while(no!=0) 285 | if(copy==sum) 286 | cout<<"Number is Armstrong"; 287 | else 288 | cout<<"Number is not Armstrong"; 289 | } 290 | 291 | 292 | /* 293 | ### Output ### 294 | Enter any number 295 | 153 296 | Number is Armstrong 297 | */ 298 | 299 | ``` 300 | 301 | 302 | 303 | 304 |
305 | 306 | 307 |


308 | 309 | 310 | **Note:** 311 | - Give a STAR if you like this 312 | - FORK to get more update 313 | - Make a PULL REQUEST to countribute 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/LOOP/WHILE LOOP/While Loop Program List.md: -------------------------------------------------------------------------------- 1 | # While Loop Program List 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |
9 | 10 | *Put your phone in desktop mode for easy access* 11 | 12 |
13 | 14 | 15 |
16 | 17 |
TABLE OF ONE 18 | 19 | ``` 20 | 21 | #include 22 | using namespace std; 23 | int main() 24 | { 25 | int i=1; 26 | while(i<=10) 27 | { 28 | cout< 51 | 52 | 53 |
54 | 55 | 56 | 57 |
58 | 59 |
PRINT DIGITS OF INTEGER VALUE IN REVERSE ORDER 60 | 61 | ``` 62 | 63 | #include 64 | using namespace std; 65 | int main() 66 | { 67 | int no,b; 68 | cout<<"Enter any number\n"; 69 | cin>>no; 70 | cout<<"Revere is given below\n"; 71 | while(no!=0) 72 | { 73 | b=no%10; 74 | cout< 91 | 92 | 93 |
94 | 95 | 96 | 97 |
98 | 99 |
CHECK NUMBER IS PALINDROME OR NOT 100 | 101 | ``` 102 | 103 | #include 104 | using namespace std; 105 | int main() 106 | { 107 | int no,b,rev=0,cpy; 108 | cout<<"Enter any number\n"; 109 | cin>>no; 110 | cpy=no; 111 | while(no!=0) 112 | { 113 | b=no%10; 114 | rev=rev*10+b; 115 | no=no/10; 116 | } 117 | if(rev==cpy) 118 | cout<<"Palindrome"; 119 | else 120 | cout<<"Not Palindrome"; 121 | } 122 | 123 | 124 | /* 125 | ### Output ### 126 | Enter any number 127 | 5885 128 | Palindrome 129 | */ 130 | 131 | ``` 132 | 133 | 134 | 135 | 136 |
137 | 138 | 139 |
140 | 141 |
FIND SUM OF DIGITS OF INTEGER VALUE 142 | 143 | ``` 144 | 145 | #include 146 | using namespace std; 147 | int main() 148 | { 149 | int no,b,sum=0; 150 | cout<<"Enter any number\n"; 151 | cin>>no; 152 | while(no!=0) 153 | { 154 | b=no%10; 155 | sum=sum+b; 156 | no=no/10; 157 | } 158 | cout<<"Total sum of digits="< 172 | 173 | 174 |
175 | 176 | 177 | 178 |
179 | 180 |
MULTIPLY OF DIGITS OF INTEGER NUMBER 181 | 182 | ``` 183 | 184 | #include 185 | using namespace std; 186 | int main() 187 | { 188 | int no,b,m=1; 189 | cout<<"Enter any number\n"; 190 | cin>>no; 191 | while(no!=0) 192 | { 193 | b=no%10; 194 | m=m*b; 195 | no=no/10; 196 | } 197 | cout<<"Total multiply of digits="< 211 | 212 | 213 |
214 | 215 | 216 | 217 | 218 |
219 | 220 |
PRINT FIRST AND LAST DIGIT OF INTEGER NUMBER 221 | 222 | ``` 223 | 224 | #include 225 | using namespace std; 226 | int main() 227 | { 228 | int no,b,last; 229 | cout<<"Enter any number\n"; 230 | cin>>no; 231 | last=no%10; 232 | while(no!=0) 233 | { 234 | b=no%10; 235 | no=no/10; 236 | } 237 | cout<<"First digit="<>no; 271 | copy=no; 272 | while(no!=0) 273 | { 274 | b=no%10; 275 | sum=sum+(b*b*b); 276 | no=no/10; 277 | } 278 | if(copy==sum) 279 | cout<<"Number is Armstrong"; 280 | else 281 | cout<<"Number is not Armstrong"; 282 | } 283 | 284 | 285 | /* 286 | ### Output ### 287 | Enter any number 288 | 153 289 | Number is Armstrong 290 | */ 291 | 292 | ``` 293 | 294 | 295 | 296 | 297 |
298 | 299 | 300 |


301 | 302 | 303 | **Note:** 304 | - Give a STAR if you like this 305 | - FORK to get more update 306 | - Make a PULL REQUEST to countribute 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/POINTER/Pointer Program List.md: -------------------------------------------------------------------------------- 1 | # Pointer Program List 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 | 9 |
10 | 11 | *Put your phone in desktop mode for easy access* 12 | 13 |
14 | 15 | 16 |
17 | 18 |
ADDITION OF TWO NUMBER 19 | 20 | ``` 21 | 22 | #include 23 | using namespace std; 24 | int main() 25 | { 26 | int a,b=20,c=30; 27 | int *p,*q,*r; 28 | p=&a; 29 | q=&b; 30 | r=&c; 31 | *p=*q+*r; 32 | cout<<"Add="<<*p; 33 | } 34 | 35 | 36 | /* 37 | ### Output ### 38 | Add=50 39 | */ 40 | 41 | ``` 42 | 43 | 44 | 45 | 46 |
47 | 48 | 49 | 50 |
51 | 52 |
USER INPUT IN POINTER 53 | 54 | ``` 55 | 56 | #include 57 | using namespace std; 58 | int main() 59 | { 60 | float a,b,c; 61 | float *p,*q,*r; 62 | p=&a; 63 | q=&b; 64 | r=&c; 65 | cout<<"Enter first number\n"; 66 | cin>>*q; 67 | cout<<"Enter second number\n"; 68 | cin>>*r; 69 | *p=*q=*r; 70 | cout<<"Add="<<*p; 71 | } 72 | 73 | 74 | /* 75 | ### Output ### 76 | Enter first number 77 | 65 78 | Enter second number 79 | 45 80 | Add=110 81 | 82 | */ 83 | 84 | ``` 85 | 86 | 87 | 88 | 89 |
90 | 91 | 92 | 93 |
94 | 95 |
SUBTRACTION OF TWO NUMBER 96 | 97 | ``` 98 | 99 | #include 100 | using namespace std; 101 | int main() 102 | { 103 | int a,b=50,c=30; 104 | int *p,*q,*r; 105 | p=&a; 106 | q=&b; 107 | r=&c; 108 | *p=*q-*r; 109 | cout<<"Sub="<<*p; 110 | } 111 | 112 | 113 | /* 114 | ### Output ### 115 | Sub=20 116 | 117 | */ 118 | 119 | ``` 120 | 121 | 122 | 123 | 124 |
125 | 126 | 127 |
128 | 129 |
MULTIPLICATION OF TWO NUMBER 130 | 131 | ``` 132 | 133 | #include 134 | using namespace std; 135 | int main() 136 | { 137 | int a,b=20,c=30; 138 | int *p,*q,*r; 139 | p=&a; 140 | q=&b; 141 | r=&c; 142 | *p=*q**r; 143 | cout<<"Multiply="<<*p; 144 | } 145 | 146 | 147 | /* 148 | ### Output ### 149 | Multiply=600 150 | 151 | */ 152 | 153 | ``` 154 | 155 | 156 | 157 | 158 |
159 | 160 | 161 | 162 | 163 |
164 | 165 |
DIVISION OF TWO NUMBER 166 | 167 | ``` 168 | 169 | #include 170 | using namespace std; 171 | int main() 172 | { 173 | float a,b=210,c=30; 174 | float *p,*q,*r; 175 | p=&a; 176 | q=&b; 177 | r=&c; 178 | *p=*q/*r; 179 | cout<<"Div="<<*p; 180 | } 181 | 182 | 183 | /* 184 | ### Output ### 185 | Div=7 186 | 187 | */ 188 | 189 | ``` 190 | 191 | 192 | 193 | 194 |
195 | 196 | 197 | 198 |
199 | 200 |
TABLE OF ONE 201 | 202 | ``` 203 | 204 | #include 205 | using namespace std; 206 | int main() 207 | { 208 | int i=1; 209 | int *p; 210 | p=&i; 211 | while(*p<=10) 212 | { 213 | cout<<*p<<"\n"; 214 | (*p)++; 215 | } 216 | } 217 | 218 | 219 | /* 220 | ### Output ### 221 | 1 222 | 2 223 | 3 224 | 4 225 | 5 226 | 6 227 | 7 228 | 8 229 | 9 230 | 10 231 | 232 | */ 233 | 234 | ``` 235 | 236 | 237 | 238 | 239 |
240 | 241 | 242 | 243 | 244 |
245 | 246 |
POINTER TO ARRAY 247 | 248 | ``` 249 | 250 | #include 251 | using namespace std; 252 | int main() 253 | { 254 | int ar[10]={10,20,50,40,60,80,70,25,45,65}; 255 | for(int i=0;i<=9;i++) 256 | { 257 | cout<<*(ar+i)<<"\n"; 258 | } 259 | } 260 | 261 | 262 | /* 263 | ### Output ### 264 | 10 265 | 20 266 | 50 267 | 40 268 | 60 269 | 80 270 | 70 271 | 25 272 | 45 273 | 65 274 | 275 | */ 276 | 277 | ``` 278 | 279 | 280 | 281 | 282 |
283 | 284 | 285 | 286 | 287 | 288 |
289 | 290 |
POINTER TO FUNCTION 291 | 292 | ``` 293 | 294 | #include 295 | using namespace std; 296 | void area(int *h,int *w) 297 | { 298 | int ar=*h* *w; 299 | cout<<"Area of rectangle="<>x; 306 | cout<<"Enter width\n"; 307 | cin>>y; 308 | area(&x,&y); 309 | } 310 | 311 | /* 312 | ### Output ### 313 | Enter height 314 | 12 315 | Enter width 316 | 13 317 | Area of rectangle=156 318 | 319 | */ 320 | 321 | ``` 322 | 323 | 324 | 325 | 326 |
327 | 328 | 329 | 330 | 331 |
332 | 333 |
POINTER TO STRUCTURE 334 | 335 | 336 | ``` 337 | 338 | #include 339 | using namespace std; 340 | struct Student 341 | { 342 | int rollno; 343 | }; 344 | int main() 345 | { 346 | struct Student obj_roll; 347 | obj_roll.rollno=205; 348 | struct Student *r; 349 | r=&obj_roll; 350 | cout<<"Roll number="<<*r; 351 | } 352 | 353 | /* 354 | ### Output ### 355 | Roll number=205 356 | 357 | */ 358 | 359 | ``` 360 | 361 | 362 | 363 | 364 |
365 | 366 | 367 |


368 | 369 | **Note:** 370 | - Give a STAR if you like this 371 | - FORK to get more update 372 | - Make a PULL REQUEST to countribute 373 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/STRUCTURE/Enumeration Program List.md: -------------------------------------------------------------------------------- 1 | # Enumeration Program List C++ 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |

9 | 10 | 11 |
12 | 13 | **NOTE** 14 | - Enum is a collection of named integer constant (i.e each element is assigned by integer value) 15 | - It is declared with enum keyword 16 | 17 | 18 | 19 | 20 | 21 | ``` 22 | 23 | #include 24 | using namespace std; 25 | enum Age 26 | { 27 | Crystabel=21, 28 | Prosper=19, 29 | Iyosayi=18, 30 | Olaoluwa=23, 31 | Etinosa=24, 32 | Nemo=16 33 | }; 34 | int main() 35 | { 36 | enum Age obj; 37 | obj=Etinosa; 38 | cout<<"The age of Etinosa="< 49 | 50 |


51 | 52 | 53 | 54 | **Note:** 55 | - This Tutorial is mainly Practical. 56 | - Give a STAR if you like this 57 | - FORK to get more update 58 | - Make a PULL REQUEST to countribute 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/STRUCTURE/Structure Program List.md: -------------------------------------------------------------------------------- 1 | # Structured Program List C++ 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |

9 | 10 | 11 |
12 | 13 |
INPUT NAME ROLLNO AND MARKS OF STUDENT AND PRINT USING STRUCTURE 14 | 15 | ``` 16 | 17 | #include 18 | #include 19 | using namespace std; 20 | struct Student 21 | { 22 | char name[200]; 23 | int rollno; 24 | float marks; 25 | }; 26 | int main() 27 | { 28 | struct Student obj; 29 | strcpy(obj.name,"Nemonet TYP"); 30 | obj.rollno=205; 31 | obj.marks=85.4; 32 | cout<<"Name="< 47 | 48 | 49 |
50 | 51 | 52 | 53 |
54 | 55 |
ADDITION PROGRAM USING STRUCTURE 56 | 57 | ``` 58 | 59 | #include 60 | #include 61 | using namespace std; 62 | struct Arithmetic 63 | { 64 | int x; 65 | int y; 66 | int z; 67 | }; 68 | int main() 69 | { 70 | struct Arithmetic obj; 71 | obj.y=20; 72 | obj.z=50; 73 | obj.x=obj.y+obj.z; 74 | cout<<"Add="< 86 | 87 | 88 |
89 | 90 | 91 | 92 |
93 | 94 |
USER INPUT IN STRUCTURE 95 | 96 | ``` 97 | 98 | #include 99 | #include 100 | using namespace std; 101 | struct Arithmetic 102 | { 103 | int x; 104 | int y; 105 | int z; 106 | }; 107 | int main() 108 | { 109 | struct Arithmetic obj; 110 | cout<<"Enter first number\n"; 111 | cin>>obj.y; 112 | cout<<"Enter second number\n"; 113 | cin>>obj.z; 114 | obj.x=obj.y+obj.z; 115 | cout<<"Add="< 132 | 133 | 134 |
135 | 136 | 137 | 138 |
139 | 140 |
SUBTRACTION PROGRAM USING STRUCTURE 141 | 142 | ``` 143 | 144 | #include 145 | #include 146 | using namespace std; 147 | struct Arithmetic 148 | { 149 | int x; 150 | int y; 151 | int z; 152 | }; 153 | int main() 154 | { 155 | struct Arithmetic obj; 156 | cout<<"Enter first number\n"; 157 | cin>>obj.y; 158 | cout<<"Enter second number\n"; 159 | cin>>obj.z; 160 | obj.x=obj.y-obj.z; 161 | cout<<"Sub="< 177 | 178 | 179 |
180 | 181 | 182 | 183 |
184 | 185 |
MULTIPLICATION PROGRAM USING STRUCTURE 186 | 187 | ``` 188 | 189 | #include 190 | #include 191 | using namespace std; 192 | struct Arithmetic 193 | { 194 | int x; 195 | int y; 196 | int z; 197 | }; 198 | int main() 199 | { 200 | struct Arithmetic obj; 201 | cout<<"Enter first number\n"; 202 | cin>>obj.y; 203 | cout<<"Enter second number\n"; 204 | cin>>obj.z; 205 | obj.x=obj.y*obj.z; 206 | cout<<"Multiply="< 222 | 223 | 224 |
225 | 226 | 227 | 228 | 229 |
230 | 231 |
DIVISION PROGRAM USING STRUCTURE 232 | 233 | ``` 234 | 235 | #include 236 | #include 237 | using namespace std; 238 | struct Arithmetic 239 | { 240 | float x; 241 | float y; 242 | float z; 243 | }; 244 | int main() 245 | { 246 | struct Arithmetic obj; 247 | cout<<"Enter first number\n"; 248 | cin>>obj.y; 249 | cout<<"Enter second number\n"; 250 | cin>>obj.z; 251 | obj.x=obj.y/obj.z; 252 | cout<<"Div="< 268 | 269 | 270 |
271 | 272 | 273 | 274 | 275 |
276 | 277 |
POINTERS TO STRUCTURE PRROGRAM 278 | 279 | ``` 280 | 281 | #include 282 | #include 283 | using namespace std; 284 | struct Student 285 | { 286 | int rollno; 287 | }; 288 | int main() 289 | 290 | { 291 | struct Student obj_roll; 292 | obj_roll.rollno=205; 293 | struct Student*r; 294 | r=&obj_roll; 295 | cout<<"Roll number="<<*r; 296 | 297 | } 298 | 299 | 300 | ### output ### 301 | 302 | Roll number=205 303 | 304 | 305 | ``` 306 | 307 | 308 | 309 | 310 |
311 | 312 | 313 | 314 | 315 | 316 |
317 | 318 |
ARRAY TO STRUCTURE PROGRAM 319 | 320 | ``` 321 | 322 | #include 323 | #include 324 | using namespace std; 325 | struct ArrayToStruct 326 | { 327 | int x; 328 | }; 329 | int main() 330 | { 331 | struct ArrayToStruct obj_array[5]; 332 | cout<<"Enter 5 value one by one\n"; 333 | for(int i=0;i<5;i++) 334 | cin>>obj_array[i].x; 335 | cout<<"Element is given below\n"; 336 | for(int j=0;j<5;j++) 337 | cout< 356 | 357 | 358 |
359 | 360 | 361 | 362 |


363 | 364 | 365 | 366 | **Note:** 367 | - This Tutorial is mainly Practical. 368 | - Give a STAR if you like this 369 | - FORK to get more update 370 | - Make a PULL REQUEST to countribute 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/STRUCTURE/Union Program List.md: -------------------------------------------------------------------------------- 1 | # Union Program List C++ 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |

9 | 10 | 11 |
12 | 13 | **NOTE** 14 | - Union is approximately same as structure but it does not support multiple value simultaneously 15 | - It supports only one value at a time 16 | - It always support last value 17 | - In given example only marks will be true because marks is the last value assigned to it 18 | 19 | 20 | 21 | 22 | ``` 23 | 24 | #include 25 | #include 26 | using namespace std; 27 | union Student 28 | { 29 | char name[200]; 30 | int rollno; 31 | float marks; 32 | }; 33 | int main() 34 | { 35 | union Student obj; 36 | strcpy(obj.name,"Nemonet TYP"); 37 | obj.rollno=205; 38 | obj.marks=85.4; 39 | cout<<"Name="< 54 | 55 |


56 | 57 | 58 | 59 | **Note:** 60 | - This Tutorial is mainly Practical. 61 | - Give a STAR if you like this 62 | - FORK to get more update 63 | - Make a PULL REQUEST to countribute 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Tutorials/C++ Basic Tutorials/Simple Programs/SWITCH/Switch Program List.md: -------------------------------------------------------------------------------- 1 | # Switch Program List in C++ 2 | 3 | **Note:** 4 | - Give a STAR if you like this 5 | - FORK to get more update 6 | - Make a PULL REQUEST to countribute 7 | 8 |
9 | 10 | *Put your phone on Desktop mode for easy access* 11 | 12 |
13 | 14 | 15 |
16 | 17 |
INPUT ANY NUMBER AND PRINT DAY OF WEEK 18 | 19 | ``` 20 | 21 | #include 22 | using namespace std; 23 | int main() 24 | { 25 | int no; 26 | cout<<"Enter any number\n"; 27 | cin>>no; 28 | switch(no) 29 | { 30 | case 1: 31 | cout<<"Monday"; 32 | break; 33 | case 2: 34 | cout<<"Tuesday"; 35 | break; 36 | case 3: 37 | cout<<"Wednesday"; 38 | break; 39 | case 4: 40 | cout<<"Thursday"; 41 | break; 42 | case 5: 43 | cout<<"Friday"; 44 | break; 45 | case 6: 46 | cout<<"Saturday"; 47 | break; 48 | case 7: 49 | cout<<"Sunday"; 50 | break; 51 | default: 52 | cout<<"Invalid Input"; 53 | } 54 | } 55 | 56 | 57 | /* 58 | ### Output ### 59 | Enter any number 60 | 2 61 | Tuesday 62 | */ 63 | 64 | ``` 65 | 66 | 67 | 68 | 69 |
70 | 71 | 72 | 73 |
74 | 75 |
INPUT ANY NUMBER AND PRINT MONTH, NAME AND NUMBER OF DAYS 76 | 77 | ``` 78 | 79 | #include 80 | using namespace std; 81 | int main() 82 | { 83 | int no; 84 | cout<<"Enter any number\n"; 85 | cin>>no; 86 | switch(no) 87 | { 88 | case 1: 89 | cout<<"January-31"; 90 | break; 91 | case 2: 92 | cout<<"February-28/29"; 93 | break; 94 | case 3: 95 | cout<<"March-31"; 96 | break; 97 | case 4: 98 | cout<<"April-30"; 99 | break; 100 | case 5: 101 | cout<<"May-31"; 102 | break; 103 | case 6: 104 | cout<<"June-30"; 105 | break; 106 | case 7: 107 | cout<<"July-31"; 108 | break; 109 | case 8: 110 | cout<<"August-31"; 111 | break; 112 | case 9: 113 | cout<<"September-30"; 114 | break; 115 | case 10: 116 | cout<<"October-31"; 117 | break; 118 | case 11: 119 | cout<<"November-30"; 120 | break; 121 | case 12: 122 | cout<<"December-31"; 123 | break; 124 | default: 125 | cout<<"Invalid Input"; 126 | } 127 | } 128 | 129 | 130 | /* 131 | ### Output ### 132 | Enter any number 133 | 3 134 | March-31 135 | */ 136 | 137 | ``` 138 | 139 | 140 | 141 | 142 |
143 | 144 | 145 | 146 |
147 | 148 |
CHECK ALPHABELT IS CONSONENT OR VOWEL METHOD 1 149 | 150 | ``` 151 | 152 | #include 153 | using namespace std; 154 | int main() 155 | { 156 | char ch; 157 | cout<<"Enter any alphabelt\n"; 158 | cin>>ch; 159 | switch(ch) 160 | { 161 | case 'a': 162 | cout<<"vowel"; 163 | break; 164 | case 'e': 165 | cout<<"vowel"; 166 | break; 167 | case 'i': 168 | cout<<"vowel"; 169 | break; 170 | case 'o': 171 | cout<<"vowel"; 172 | break; 173 | case 'u': 174 | cout<<"vowel"; 175 | break; 176 | default: 177 | cout<<"Consonent"; 178 | } 179 | } 180 | 181 | 182 | /* 183 | ### Output ### 184 | Enter any number 185 | m 186 | Consonent 187 | */ 188 | 189 | ``` 190 | 191 | 192 | 193 | 194 |
195 | 196 | 197 | 198 |
199 | 200 |
CHECK ALPHABELT IS CONSONENT OR VOWEL METHOD 2 201 | 202 | ``` 203 | 204 | #include 205 | using namespace std; 206 | int main() 207 | { 208 | char ch; 209 | cout<<"Enter any alphabelt\n"; 210 | cin>>ch; 211 | switch(ch) 212 | { 213 | case 'a': 214 | case 'e': 215 | case 'i': 216 | case 'o': 217 | case 'u': 218 | cout<<"vowel"; 219 | break; 220 | default: 221 | cout<<"Consonent"; 222 | } 223 | } 224 | 225 | 226 | /* 227 | ### Output ### 228 | Enter any number 229 | o 230 | vowel 231 | */ 232 | 233 | ``` 234 | 235 | 236 | 237 | 238 |
239 | 240 | 241 | 242 | 243 |
244 | 245 |
SIMPLE CALCULATOR PROGRAM 246 | 247 | ``` 248 | 249 | #include 250 | using namespace std; 251 | int main() 252 | { 253 | float x,y; 254 | cout<<"Enter first number\n"; 255 | cin>>x; 256 | cout<<"Enter second number\n"; 257 | cin>>y; 258 | cout<<"Enter\n+ for add\n- for sub\n* for multiply\n/ for div\n"; 259 | cin>>ch; 260 | switch(ch) 261 | { 262 | case '+': 263 | cout<<"Add="<<(x+y); 264 | break; 265 | case '-': 266 | cout<<"Sub="<<(x-y); 267 | break; 268 | case '*': 269 | cout<<"Multiply="<<(x*y); 270 | break; 271 | case '/': 272 | cout<<"Div="<<(x/y); 273 | break; 274 | default: 275 | cout<<"Invalid Input!!!"; 276 | } 277 | } 278 | 279 | 280 | /* 281 | ### Output ### 282 | Enter first number 283 | 45 284 | Enter second number 285 | 5 286 | Enter 287 | + for add 288 | - for sub 289 | * for multiply 290 | / for div 291 | 292 | + 293 | Add=50.0 294 | 295 | */ 296 | 297 | 298 | ``` 299 | 300 | 301 | 302 | 303 |
304 | 305 | 306 | 307 |
308 | 309 |
SIMPLE ATM PROGRAM 310 | 311 | ``` 312 | 313 | #include 314 | using namespace std; 315 | int main() 316 | { 317 | float amt,creditamt,debitamt; 318 | char ch; 319 | cout<<"Enter initial amount\n"; 320 | cin>>amt; 321 | cout<<"Enter\nc for credit\nd for debit\nb for balance\n"; 322 | cin>>ch; 323 | switch(ch) 324 | { 325 | case 'c': 326 | cout<<"Enter credit amount\n"; 327 | cin>>creditamt; 328 | amt=amt+creditamt; 329 | cout<<"New Amount="<>debitamt; 334 | if(amt>=debitamt) 335 | { 336 | amt=amt+debitamt; 337 | cout<<"New Amount="< 373 | 374 | 375 |
376 | 377 | 378 | 379 | 380 | 381 | 382 |


383 | 384 | **Note:** 385 | - Give a STAR if you like this 386 | - FORK to get more update 387 | - Make a PULL REQUEST to countribute 388 | 389 | 390 | 391 | 392 | 393 | 394 | -------------------------------------------------------------------------------- /Tutorials/README.md: -------------------------------------------------------------------------------- 1 | # About Tutorial 2 | 3 | ![th-3393691394](https://github.com/The-Young-Programmer/C-CPP-Programming/assets/79866006/4c9d99a5-a0e0-4e12-b0e5-05e0e86cf0c3) 4 | 5 | 6 | 7 | You can access a wide range of tutorials directly within our dedicated mobile application, 8 | which is designed to cater to both Android and iOS users. 9 | 10 | - The app provides a user-friendly interface and an extensive collection of tutorials that cover various subjects. 11 | - Whether you're looking to enhance your skills, learn new techniques, or explore different topics, our app has got you covered. 12 | - To begin your learning C/C++ Programming journey, simply click here to initiate the app download process. 13 | 14 | 15 | -------------------------------------------------------------------------------- /Tutorials/UNIBEN STUDENT/readme.md: -------------------------------------------------------------------------------- 1 | # This Contains CSC224 Past questions and answers for UNIBEN Student 2 | 3 | **Note:** 4 | - This Tutorial is mainly Practical. 5 | - Give a STAR if you like this 6 | - FORK to get more update 7 | - Make a PULL REQUEST to countribute -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img1.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img10.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img11.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img12.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img13.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img14.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img15.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img16.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img17.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img18.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img19.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img19.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img2.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img20.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img21.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img22.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img22.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img23.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img23.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img24.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img25.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img26.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img26.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img27.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img27.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img28.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img28.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img29.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img29.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img3.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img30.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img30.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img31.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img31.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img32.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img32.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img33.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img33.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img34.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img34.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img35.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img35.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img36.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img36.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img37.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img37.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img38.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img38.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img38b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img38b.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img39.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img39.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img4.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img40.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img40.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img41.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img41.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img42.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img42.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img5.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img6.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img7.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img8.jpg -------------------------------------------------------------------------------- /Tutorials/imgs/C++/img9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codetoanbug/C-CPP-Programming/877d185fd9d32170d42ca11e85480afceeafcdc2/Tutorials/imgs/C++/img9.jpg --------------------------------------------------------------------------------