Another week of coding, another set of challenges! In Week 2, I dived deeper into C++ by exploring advanced topics like strings, bitwise operations, and object-oriented programming (OOP). Each day brought new concepts and problem-solving techniques that strengthened my understanding of C++.
Day 8: Exploring Strings
Strings are an essential part of C++ programming, used for handling text and character data.
🚀 Topics Covered:
✅ Character arrays vs. string class
✅ String operations (concatenation, comparison, substring)
✅ String manipulation functions
✅ String streams
💻 Key Practice:
🔹 Reversed a string
🔹 Checked if a string is a palindrome
🔹 Counted vowels and consonants
🔹 Removed spaces from a string
🔹 Found the first non-repeating character
Day 9: Introduction to Bitwise Operations
Bitwise operations allow efficient manipulation of individual bits, which is useful for optimizing performance.
🚀 Topics Covered:
✅ AND, OR, XOR, NOT operators
✅ Left & Right Shift operations
✅ Setting, clearing, and toggling bits
✅ Updating the i-th bit
💻 Key Practice:
🔹 Extracted the i-th bit of a number
🔹 Set and cleared specific bits
🔹 Toggled bits in an integer
🔹 Implemented bitwise tricks for fast computations
Day 10: Advanced Bit Manipulation
Taking bitwise operations further, I explored real-world applications of bit manipulation.
🚀 Topics Covered:
✅ Checking if a number is a power of 2
✅ Counting set bits efficiently
✅ Generating subsets using bitwise techniques
💻 Key Practice:
🔹 Counted the number of ones in a binary representation
🔹 Generated all subsets of an integer set
🔹 Generated all subsets of a character set
Day 11: XOR Properties & Unique Number Problems
XOR operations have powerful applications in finding unique numbers in an array.
🚀 Topics Covered:
✅ XOR properties and their applications
✅ Finding unique numbers in different scenarios
✅ Efficiently counting set bits
💻 Key Practice:
🔹 Found a unique number in an array where all others appear twice
🔹 Found two unique numbers in an array
🔹 Found a unique number where all others appear thrice
Day 12: Structures, Unions, and Enums
Structures and unions help in organizing and optimizing data storage, while enums provide meaningful constants.
🚀 Topics Covered:
✅ Defining and using structures
✅ Memory efficiency with unions
✅ Using enums for readability
💻 Key Practice:
🔹 Created an Employee struct and found the highest salary
🔹 Demonstrated how unions store different data types
🔹 Implemented an enum for days of the week
Day 13: Introduction to Classes & Objects
Classes are the foundation of object-oriented programming in C++.
🚀 Topics Covered:
✅ Defining and using classes
✅ Object-oriented programming basics
✅ Access specifiers: public, private, protected
💻 Key Practice:
🔹 Created a Student class with attributes
🔹 Implemented a Circle class with a function to calculate area
Day 14: Nesting of Member Functions
I explored function nesting inside classes to enhance encapsulation.
🚀 Topics Covered:
✅ Private member functions
✅ Nesting functions for better encapsulation
✅ One’s complement operation
💻 Key Practice:
🔹 Validated binary format using a private function
🔹 Performed one’s complement operation
🔹 Implemented binary addition using a Binary class
Key Takeaways from Week 2:
🔹 Bit manipulation is an incredibly powerful technique for optimizing performance in problem-solving. If you understand the logic you'll find it much better than normal way of solving a problem. Though it was a bit tough understanding the concepts I am sure it would be useful later on.
🔹 OOP concepts like classes and structures help in writing organized and maintainable code.
🔹 Strings and their operations are fundamental to text processing in C++.
What’s Next?
Next I’ll explore dynamic memory allocation, inheritance, and polymorphism to deepen my OOP understanding.
Learning C++ has been an exciting journey so far, and I’m eager to keep pushing forward! Let me know your thoughts—how do you approach these concepts in C++? 🚀
Top comments (0)