Built a custom string handling class in C++ from scratch — without using std::string. This project focuses on: • Dynamic memory management using new[] and delete[] • Implementation of the Rule of Three (Destructor, Copy Constructor, Copy Assignment) • Manual string manipulation algorithms (reverse, case conversion, word counting) • Operator overloading for intuitive usage (+, +=, [], (), comparison operators) The goal was to deeply understand how strings work internally rather than relying on built-in abstractions. A great exercise in mastering memory management, object-oriented programming, and low-level string operations in C++. #cpp #programming #softwareengineering #oop #learning #developers
More Relevant Posts
-
🚀 Turning Logic into Art with C++ Today, I worked on building a pattern generation program using C++ and recursion — and the result was something visually satisfying: a perfectly aligned diamond/star pattern rendered in the console. What looks like a simple pattern actually involves: ✔️ Understanding recursion deeply ✔️ Managing multiple variables efficiently ✔️ Controlling flow for symmetrical design ✔️ Writing clean and optimized logic This small project reminded me that programming is not just about solving problems — it’s also about creativity and precision. Even a console output can feel like art when logic is applied the right way. 💡 Key takeaway: Strong fundamentals in Data Structures and recursion can help you build elegant and efficient solutions, even for problems that seem simple at first glance. Always learning. Always building. #Cplusplus #Programming #DSA #Recursion #CodingJourney #SoftwareDevelopment #ProblemSolving
To view or add a comment, sign in
-
-
Solved a Gray Code problem in C++ today. The task was to generate bit patterns from 0 to 2^n - 1 such that every consecutive pattern differs by only one bit, while always starting from 0. I used the Gray code formula: gray = i ^ (i >> 1) This makes the solution clean and efficient, and guarantees that adjacent codes differ by exactly one bit. Example for n = 2: 00 -> 01 -> 11 -> 10 What I like about this problem is how a simple bit manipulation formula can solve what looks like a complex sequence-generation challenge. Concepts practiced: Bit Manipulation Binary Representation Pattern Generation C++ Problem Solving #cpp #coding #programming #datastructures #algorithms #problemsolving #bitmanipulation #leetcode #geekforgeeks
To view or add a comment, sign in
-
-
C Programming: Array Sum Calculator. #CProgramming #Programming #Coding #DataStructures #SoftwareEngineering #LearningJourney #include<Stdio.h> int main() { int size; printf("Enter the size : "); scanf("%d",&size); int arr[size]; for(int i=0; i<size; i++) { printf("a[%d] : ",i); scanf("%d",&arr[i]); } int sum=0; for(int i=0; i<size; i++) { sum=sum+arr[i]; } printf("Sum : %d\n",sum); return 0; }
To view or add a comment, sign in
-
Generic programming in C is not missing. It’s just not handed to you. You can fake it with void*, abuse the preprocessor, or use template-style macros. Or you can generate real code and debug it like normal C. I wrote a breakdown of all approaches and why I prefer code generation. https://lnkd.in/dAGvr-XX
To view or add a comment, sign in
-
Post No: 048 A small but interesting thing I recently got to know in C++ is how static_cast behaves with string literals. When I write “hello”, I thought it is a std::string, but it is not. A string literal in C++ is actually of type const char[]. In most expressions, this array decays into a pointer, which is why: auto text = “hello”; makes text a const char*, not a std::string. This is also why static_cast may seem to “cast it to a pointer”. What is really happening is array-to-pointer conversion. The important thing to understand is that std::string and std::string_view are class types. To create them, we need object construction. For std::string: std::string str = static_cast<std::string>(“hello”); For std::string_view: std::string_view sv = static_cast<std::string_view>(“hello”); We can also directly construct them in a cleaner way: std::string str(“hello”); std::string_view sv(“hello”); I got to learn this in a hard way, hope this makes things more easy for someone else. #cpp #cplusplus #programming #softwaredevelopment #coding #learning
To view or add a comment, sign in
-
✨💻 C++ POINTERS – SIMPLE & SMART NOTES 💻✨ 📌 "int *ptr;" 👉 Declare a pointer 📌 "ptr = &x;" 👉 Store address of variable 📌 "cout << *ptr;" 👉 Access value using pointer 🔹 Quick Concept: Pointers don’t store values ❌ They store memory addresses 📍 🔹 Symbols to Remember: & → Address of variable * → Value at address 🚀 Why use pointers? ✔ Efficient memory use ✔ Important for Data Structures ✔ Helps in dynamic programming 💡 Master pointers = Master C++ #Cpp #Programming #CodingNotes #StudentLife #LearnCoding
To view or add a comment, sign in
-
-
🔹 Part2: Exploring type_traits in C++ (is_integral & enable_if) This short video is part of my "C++ Programming Topics" series 👇 And also included in my broader C++ templates playlist. 💡 The problem: When writing generic C++ code, not every type should be treated the same way. This can lead to: -Invalid operations on unsupported types -Hard-to-read template errors -Fragile and unsafe generic code ❌ 📌 This is where the type_traits library becomes essential: 👉 It gives you compile-time tools to inspect and control types. 💡 The solution: Understanding and implementing core utilities like: ✔️ is_integral — detect whether a type is an integral type ✔️ enable_if — conditionally enable/disable functions ✔️ type_traits — the foundation of compile-time type logic ⚙️ Bonus insight from the video: You’ll explore simplified implementations to really understand how they work under the hood: 1️⃣ is_integral How the compiler determines if a type belongs to integral types 2️⃣ enable_if How to include/exclude functions during compilation 3️⃣ Combining both Apply constraints to templates for safer and cleaner code 🎯 Key takeaway: Don’t just use type_traits—understand how they work. That’s what unlocks the real power of modern C++ templates. 🎥 Watch the video: https://lnkd.in/d7zPHDzb 📚 Full playlist: https://lnkd.in/dDNVWvVC #cpp #moderncpp #programming #softwareengineering #templates #metaprogramming #cleancode
To view or add a comment, sign in
-
Deep dive into C++ Generic Programming: Implementing the "Graal" Library. "I’m excited to share my latest project: Project Graal. 🚀 As part of my Computer Science studies, I developed a custom C++ template library that recreates essential algorithms from the STL (Standard Template Library). The goal was to master Generic Programming and understand how memory is manipulated under the hood using iterators. Key implementations include: Search & Comparison: find_if, all_of, any_of, equal. Range Manipulation: reverse, copy, and partition. The Challenge: Implementing unique using the two-pointer technique (slow and fast iterators) to filter data in-place. This project pushed me to understand how C++ handles types at compile-time using templates and how to write clean, documented code using Doxygen. Check out the full repository here: 🔗 https://lnkd.in/darWrFUm #Cpp #Programming #SoftwareDevelopment #GenericProgramming #ComputerScience #Algorithms"
To view or add a comment, sign in
-
🚀 Understanding SOLID Principles in C++ – Liskov Substitution Principle (LSP) Today, I explored one of the most important design principles in Object-Oriented Programming – the Liskov Substitution Principle (LSP). 🔍 What is LSP? LSP states that objects of a derived class should be replaceable with objects of the base class without breaking the program. 💡 What I implemented: ✔️ Designed a clean abstraction using: DepositOnlyAccount (base interface) WithdrawableAccount (extended interface) SavingAccount (concrete implementation) ✔️ Ensured proper hierarchy where: Deposit-only accounts are not forced to implement withdrawal Withdrawal functionality is only available where it logically makes sense 🔥 Key Learning: Instead of forcing all accounts to support both deposit and withdrawal (which violates LSP), we segregate responsibilities and design flexible, scalable systems. 📌 This improves: Code maintainability Extensibility Real-world modeling accuracy 💻 Tech Stack: C++, OOP, SOLID Principles #CPlusPlus #OOP #SOLIDPrinciples #LLD #SystemDesign #Programming #SoftwareEngineering #CodingJourneyRohit Negi
To view or add a comment, sign in
-
-
Today I worked on a classic problem: rotating a 2D matrix by 90° clockwise and understood a clean, efficient approach 🚀 💡 Instead of using extra space, we can solve it in-place using two simple steps: 1️⃣ Transpose the matrix → Convert rows into columns by swapping matrix[i][j] with matrix[j][i] 2️⃣ Reverse each row → Use two-pointer technique to swap first and last elements, moving inward ✨ Why this works? Transpose changes the direction of elements, and reversing each row completes the 90° rotation. 🧠 Key takeaway: Rotate = Transpose + Reverse rows 📌 This approach improves problem-solving skills in arrays and helps understand matrix transformations deeply. #Java #LeetCode #DataStructures #CodingJourney #ProblemSolving #Programming #Students #Learning
To view or add a comment, sign in
-
More from this author
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
That's greaaat Muhammad Shoaib Ul Hassan!! 🌟🌟🌟 Keep growing!! 🔥🔥