I tested the program and got the same error as you.
My solution is as follows:
Open the project properties, click C/C++->Language->Conformance mode, set it to NO and you could run the program.
RESULT:
Best regards,
Elya
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.