Mahmoud Derbi (mmderbi)

Mahmoud Derbi

All people are clowns ๐Ÿ˜Ž

29 Followers

Recent casts

๐Ÿš€ C++ Programming โ€” Part 16: Multi-Dimensional Arrays ๐Ÿ”ข So far, weโ€™ve used one-dimensional arrays (lists). Now, letโ€™s level up with multi-dimensional arrays โ€” like tables or grids ๐Ÿ’ก --- ๐Ÿ”น What Are They? A 2D array is basically an array of arrays. Think of it as rows and columns ๐Ÿ‘‡ int matrix[2][3] = { {1, 2, 3}, {4, 5, 6} }; This creates 2 rows ร— 3 columns = 6 elements. --- ๐Ÿ”น Accessing Elements: cout << matrix[0][2]; // 3 cout << matrix[1][1]; // 5 The first index = row, the second = column. --- ๐Ÿ”น Looping Through a 2D Array: for (int i = 0; i < 2; i++) { for (int j = 0; j < 3; j++) { cout << matrix[i][j] << " "; } cout << endl; } โœ… Output: 1 2 3 4 5 6 --- ๐Ÿ”น Why Use Them? 2D arrays are perfect for grids, game maps, matrices, or seating charts ๐ŸŽฎ --- ๐Ÿ”น Coming next (Part 17): Weโ€™ll explore vectors โ€” dynamic arrays that grow and shrink automatically ๐Ÿš€

  • 1 reply
  • 2 recasts
  • 3 reactions

๐Ÿš€ C++ Programming โ€” Part 15: Arrays & Memory โšก Now that you can loop through arrays, itโ€™s time to understand how they live in memory โ€” and why C++ gives you so much control ๐Ÿ” --- ๐Ÿ”น What Is an Array? An array is a group of variables of the same type stored next to each other in memory ๐Ÿ‘‡ int nums[3] = {10, 20, 30}; Each element is stored in order โ€” and you can access them by index: cout << nums[0]; // 10 --- ๐Ÿ”น Arrays & Memory Addresses: Every element has its own memory address ๐Ÿ”ข

  • 1 reply
  • 1 recast
  • 3 reactions

๐Ÿš€ C++ Programming โ€” Part 14: Loops with Strings & Arrays ๐Ÿ” Now that you know how strings and arrays work โ€” letโ€™s learn how to loop through them efficiently ๐Ÿ‘‡ ๐Ÿ”น Looping Through an Array: Use a for loop to go through each element one by one ๐Ÿ‘‡ int numbers[] = {10, 20, 30, 40}; for (int i = 0; i < 4; i++) { cout << numbers[i] << " "; } โœ… Output: 10 20 30 40 --- ๐Ÿ”น Looping Through a String: Each character in a string can be accessed like an array element ๐Ÿ‘‡ string word = "Hello"; for (int i = 0; i < word.length(); i++) { cout << word[i] << " "; } โœ… Output: H e l l o --- ๐Ÿ”น Using Range-Based For Loop (Modern C++): A cleaner and more readable way ๐Ÿ‘‡ for (char c : word) { cout << c << " "; } โœ… Same result โ€” but shorter and safer! --- ๐Ÿ”น Coming next (Part 15): Weโ€™ll explore arrays & memory together โ€” how theyโ€™re stored and how pointers interact with them โšก

  • 1 reply
  • 2 recasts
  • 3 reactions

Top casts

๐Ÿš€ C++ Programming โ€” Part 7: Arrays So far, weโ€™ve stored one value per variable. But what if you need to store many values of the same type? ๐Ÿค” Thatโ€™s where arrays come in! ๐Ÿ”น What Is an Array? An array is a collection of elements stored under one name โ€” like a list ๐Ÿ“ฆ Example ๐Ÿ‘‡ int numbers[5] = {10, 20, 30, 40, 50}; โœ… This creates 5 integer slots: numbers[0] = 10, numbers[1] = 20, โ€ฆ numbers[4] = 50 --- ๐Ÿ”น Accessing Elements: cout << numbers[2]; // Output: 30 ๐Ÿ”น Using Loops with Arrays: for (int i = 0; i < 5; i++) { cout << numbers[i] << " "; } โœ… Prints: 10 20 30 40 50 --- ๐Ÿ”น Why Use Arrays? They make it easy to manage large sets of data without creating dozens of variables ๐Ÿ’ช ๐Ÿ”น Coming next (Part 8): Weโ€™ll explore functions โ€” how to organize your code and make it reusable ๐Ÿง 

  • 3 replies
  • 1 recast
  • 8 reactions

๐Ÿš€ C++ Programming โ€” Part 6: Loops (For & While) Sometimes you need your code to repeat tasks โ€” like printing numbers or checking data ๐Ÿ” Thatโ€™s what loops do! ๐Ÿ”น For Loop: Used when you know how many times to repeat ๐Ÿ‘‡ for (int i = 1; i <= 5; i++) cout << i << endl; โœ… Prints 1โ€“5 ๐Ÿ”น While Loop: Repeats until the condition is false ๐Ÿ‘‡ int x = 1; while (x <= 5) { cout << x << endl; x++; } ๐Ÿ”น Do-While: Runs the code at least once ๐Ÿ‘‡ int y = 1; do { cout << y << endl; y++; } while (y <= 5); ๐Ÿ”น Why It Matters: Loops save time, reduce code, and handle repetition automatically โš™๏ธ ๐Ÿ”น Coming next (Part 7): Weโ€™ll learn arrays โ€” how to store multiple values easily ๐Ÿง 

  • 3 replies
  • 1 recast
  • 6 reactions

๐Ÿš€ C++ Programming โ€” Part 4: Operators & Expressions Now that you know how to store data using variables, letโ€™s learn how to make your program think and calculate ๐Ÿ”น What Are Operators? Operators are symbols that tell the computer what to do with your data โ€” like adding, comparing, or combining values. ๐Ÿ”น Types of Operators: 1๏ธโƒฃ Arithmetic Operators: + - * / % Example: int x = 10 + 5; // x = 15 int y = 10 % 3; // y = 1 (remainder) 2๏ธโƒฃ Comparison Operators: Used to compare values (result is true or false): == != > < >= <= Example: if (x > y) { cout << "x is greater!"; } 3๏ธโƒฃ Logical Operators: Used for combining conditions: && (AND) || (OR) ! (NOT) Example: if (age > 18 && hasID) { cout << "Access granted"; } Why It Matters: Operators are the โ€œbrainโ€ of your code โ€” they make decisions, perform math, and control logic. ๐Ÿ”น Coming next (Part 5): Weโ€™ll dive into if statements and conditions โ€” how your program makes decisions ๐Ÿง 

  • 2 replies
  • 0 recasts
  • 3 reactions

๐Ÿš€ Introduction to C++ Programming If youโ€™re into coding and want to start with a powerful, fast, and professional language, C++ is the perfect place to begin ๐Ÿ’ป ๐Ÿ”น What is C++? C++ is a general-purpose language that evolved from C in the 1980s. Itโ€™s known for its speed, efficiency, and full control over system resources โ€” thatโ€™s why itโ€™s used in operating systems, games, AI, and high-performance software. ๐Ÿ”น Why learn C++? Itโ€™s the base of many modern languages like Java, C#, and Python. It teaches you how computers truly work โ€” not just how to code. It powers game engines (Unreal Engine), embedded systems, and large apps. ๐Ÿ”น What can you build with it? Anything from a simple โ€œHello Worldโ€ ๐Ÿ˜„ to massive projects like PUBG or Fortnite ๐ŸŽฎ ๐Ÿ”น Final thought: C++ isnโ€™t the easiest to learn, but it builds real programming skills and deep understanding. Start small โ€” and let your code speak for you ๐Ÿ’ช

  • 3 replies
  • 0 recasts
  • 3 reactions

Onchain profile

Ethereum addresses