Hi
The 1st one is the logical part; 2nd is up to your IDE, libraries, and programming language.
As I have not the foggiest idea of the 2nd, I'll reffer to the 1st part.
You are in check mate, if and only if, you can't avoid your king being taken by any of the opponent's pieces, whatever it is the piece you move (not only your king), each other, to any of all its allowed lockers.
So, you would have to evaluate, for each one of your (alive) pieces (that you may have in a List<> or vector in C++), for each one of their possible moves, if you remain in check. If moving ANY of your pieces, WHEREVER they can move to, does not annul the check (*), then you are in check mate. I would recommend start the search by finding if any of your pieces can take the opponent piece that is threatening your king (and then verify if you are still in check - it may happen that you can take the piece which points to your king, but moving that piece of yours, unblocks it from an aligned opponent's rook - SO, for EACH possible move of ALL your pieces, it's necesary to do a complete test). If this is not posible, then I would continue verifying if a move of your king might annul the check. If there isn't, then you would have to check all of your pieces' allowed moves in order to find out is there is any way to block the threat. If you find any way to annul the check, then stop there the function process returning false (you were not in check mate).
By the way, for this, previously, you would need a function to determine if you are in check. This is not as simple as anyone might think quickly. You are in check when one opponent piece is at one move of taking your king. But this does not occur only if your opponent aligns a rook, or a bishop pointing to your king. It may also happen if he moves a piece, that was blocking another one of his, and then you are in check by a piece that was not moved.
Maybe all this is a bit complicated. I have to say that I play chess since I was a kid.
Feel free to ask if you have any more doubt
Pablo