When I was making a login in program I need to do the same thing you are asking. I will post my signup function below. It shows how to do this.
Code:
void signup()
{
char name[10],pass[10],filename[12],combo[19];//variables I need
cout << "Enter 8 character user name:";
cin >> name;
cout << "Enter 8 characater password:";
cin >> pass;
strcpy(filename,name);//copy name to filename so i have two to manipulate
strcat(filename,".txt");//add ".txt" to the end of file name
strcpy(combo,name);//copy name to combo
strcat(combo,".");//add a dot to the end of combo
strcat(combo,pass);//add pass to the end of combo
ofstream a_file(filename);//create a file named "username.txt"
a_file<<combo;//write the text combo into it
cout<<"\n\nYou Have Successfully Signed Up.\n\n";
system("PAUSE");
}
Be sure to include <string.h>.
If you need more explaination just say so and I will help you more with it. I think my commented code will be enuff though. and <fstream.h>