a.out 5 5 :"No map size entered"
This is quite clear (beside that the message text differs from the one printed by your code as already mentioned by Richard). Your code checks if exactly one argument has been passed and terminates when
argc
is not 2.
With the above commands
argc
is 3 and
argv[0]
= "a.out",
argv[1]
= "5", and
argv[2]
is "5".
So you may rewritre your check to give more detailed messages:
if (argc < 2)
{
cerr << "No maze size entered." <<endl;
return -1;
}
else if (argc > 2)
{
cerr << "Too many arguments." <<endl;
return -1;
}
./a.out 5 : Memory leak, program loops
You did not show the code that generates this message. At least the tests shown in your question has been passed.