#include <iostream>
#include <fstream>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
using namespace std;
int main()
{
std::string newusername;
std::string newuserpassword;
{
cout<<"Please enter a user name to use (one word only, 30 letters): ";
cin>>newusername;
cin.ignore();
cout<<"\n"<<newusername<<" is now being used as your username.\n\n";
cout<<"Enter a password to use for "<<newusername<<"'s account: ";
cin>>newuserpassword;
cin.ignore();
cout<<"\nPlease wait while your account ('"<<newusername<<"') is created...";
cout<<"\n\nCreating User Folder...";
mkdir("C:/Program Files/MUMS/");
std::string newDir="C:/Program Files/MUMS/"+newusername;
mkdir(newDir.c_str());
cout<<"\nCreating Username File...";
std::string unfile="C:/Program Files/MUMS/";
unfile+=newusername;
unfile+="/username.mums";
ofstream usernamecreate;
usernamecreate.open(unfile.c_str());
usernamecreate<<newusername<<endl;
usernamecreate.close();
cout<<"\n"<<newusername<<"'s User Name file successfully created!...";
cout<<"\nCreating Password File...";
std::string pfile="C:/Program Files/MUMS/";
pfile+=newusername;
pfile+="/password.mums";
ofstream userpasswordcreate;
userpasswordcreate.open(pfile.c_str());
userpasswordcreate<<newuserpassword<<endl;
userpasswordcreate.close();
cout<<"\n"<<newusername<<"'s Password saved successfully!...";
cout<<"\n\nDone!";
cout<<"\n\nYour User Name is '"<<newusername<<"' and your password is '"<<newuserpassword<<"'.\n"
"Make sure that you know these, as there is no way of retirieving\nthis information.";
cin.get();
}
}