This is a simple, fun, and secure console application in C++ that requests input from the user for three different weapons found in a magical weapons chest in an RPG-type of scenario. The user inputs are for the following: Flaming Sword (fire), Snooze Bow (sedative), Felling Axe (destruction). The program utilizes dynamic memory allocation and input validation.
-
Secure dynamic memory management using 'new' and 'delete'
-
Avoid buffer overflows with validated integer input
-
Validates input stream using 'std::cin.fail()'
-
Handles memory allocation failure with 'try/catch' and 'std::bad_alloc'
-
Pointers are set to 'nullptr' after deletion to prevent dangling references
-
Flaming Sword: Accepts a fire damage value
-
Snooze Bow: Accepts a sedative strength value
-
Felling Axe: Accepts a destruction force value