[Contest] C++ Namespace


Submit solution

Points: 10
Time limit: 0.5s
Memory limit: 30K

Author:
Problem type
Allowed languages
C++

NameSpace for Library Management System

You are tasked with organizing and managing different aspects of a software project using namespaces. Create a C++ program that demonstrates the use of namespaces for structuring and separating code components.

Consider a software project related to a library. The project has the following components:

  1. Library Management: This component deals with managing books, patrons, and library operations.

  2. User Interface: This component handles user interactions and displays information.

  3. Utilities: This component contains general utility functions and helper classes.

Your task is to organize the code related to these components into separate namespaces and demonstrate how to access and use elements from each namespace.

Create the following namespaces and include appropriate components in each:

  • LibraryManagement namespace for library management-related code.
  • UserInterface namespace for user interface-related code.
  • Utilities namespace for utility functions and classes.

Write a program that demonstrates the following:

  1. Define a structure Book in the LibraryManagement namespace with attributes like title, author, and ISBN.
  2. Create a function displayBookInfo in the UserInterface namespace that takes a Book object as a parameter and displays its information.
  3. Define a class Date in the Utilities namespace with attributes like day, month, and year.
  4. Create a function isValidDate in the Utilities namespace that checks if a given date is valid (e.g., day, month, and year are within reasonable ranges).
  5. In the main function, demonstrate how to use the Book structure, displayBookInfo function, Date class, and isValidDate function from their respective namespaces.

Ensure to include proper header files and use appropriate naming conventions for namespaces, structures, functions, and classes.

Note:

  • You don't need to implement a full library management system but demonstrate the organization and usage of namespaces.

Comments

There are no comments at the moment.