What's the question? Where do you need help exactly?
Also note that this forum supports code formatting, which we all prefer. Most of us don't even read posts that contain unformatted code. Format code like this:
[code]
1 2
//Code here.
//The line numbering is automatic and a great help.
Well, you know cin >> filename reads input from the keyboard because you showed it. Do you know what type of variable you need 'filename' to be? Why don't you post a complete CPP file here? That will show us what you know and what you don't know.