It works fine no errors except 1 it doesnt stay on screen the dos windo immedietly closes in a blink of an eye y is that?
What did you expect it to do? It completed all of its instructions, so it has no reason to remain open. Remember, software is dumb and doesn't do anything except what you tell it to do, and you haven't told it to wait at the end.
Never assume that your program will do what you want it to do, only what you told it to do (which may not actually be
what you want it to do if your logic is wrong).