DEV Community

Adhyan Jain
Adhyan Jain

Posted on

Week 7 : Advanced OOP Practice in C++


With exams ongoing, I focused on advanced OOP problems in C++. Each day tackled unique challenges, strengthening my grasp of key concepts.

Day 43 โ€“ OOP Basics

  • Temperature Converter โ€“ Convert between Fahrenheit & Celsius.
  • Arithmetic Operations โ€“ Perform basic operations on two integers.
  • Toy House Surface Area โ€“ Compute surface area (excluding the roof).
  • Weather Analysis โ€“ Compare historical & current weather conditions.

Day 44 โ€“ Constructors & Math Operations

  • Palindrome Checker โ€“ Verify palindromes using constructors & destructors.
  • Matrix Determinant โ€“ Compute determinant of a square matrix.
  • Power & Root Calculator โ€“ Calculate squares, cubes & their roots.
  • Rectangle Area โ€“ Compute area using coordinate-based input.

Day 45 โ€“ Static Members

  • Event Management โ€“ Track participant count using static members.
  • Rectangle Count โ€“ Maintain count & compute areas of multiple rectangles.
  • Bank Interest Calculator โ€“ Update & apply shared interest rates.
  • Circle Tracker โ€“ Track circle count & compute area/circumference.

Day 46 โ€“ Inline Functions

  • Area Calculator โ€“ Compute areas using inline functions.
  • Armstrong Number โ€“ Verify & print factors using inline methods.
  • GCD Calculation โ€“ Compute GCD using Euclidโ€™s algorithm.
  • Arithmetic Operations โ€“ Implement basic operations using inline functions.

Day 47 โ€“ Call by Reference & String Analysis

  • Swap Numbers โ€“ Implement swapping using call-by-reference.
  • Salary Update โ€“ Calculate updated salary post-hike.
  • Message Analysis โ€“ Count letters, digits & special characters.
  • Fibonacci Last Digit โ€“ Compute last digit of nth Fibonacci number.

Day 48 โ€“ Default Arguments & Real-World Apps

  • Perfect Number Check โ€“ Validate perfect numbers with flexible input.
  • Library Book Counter โ€“ Track book counts across categories.
  • Hotel Booking System โ€“ Compute total stay cost based on preferences.
  • Calorie Calculator โ€“ Estimate calories burned based on workout type & intensity.

Day 49 โ€“ Friend Functions & Advanced OOP

  • Matrix Transposition โ€“ Use friend functions for transposition.
  • Ticket Reservation System โ€“ Manage ticket reservations/cancellations.
  • Fraction Addition โ€“ Add mixed fractions & return reduced form.
  • Distance Calculation โ€“ Compute travel distance using friend functions.

Key Takeaways:

  • Strengthened OOP conceptsโ€”constructors, destructors, static members, inline functions & friend functions.
  • Improved debugging & real-world problem-solving.

Challenges:

  • Optimizing recursive determinant calculation.
  • Managing shared/static data effectively.

This practice pushed my OOP proficiency to a new level!

Whatโ€™s the most challenging OOP problem youโ€™ve solved? Letโ€™s discuss!


Top comments (0)