Username and password system

I am working on a username/password system, and I don't know how to do file saving.
If anyone could help me out on how to modify this code to save the char username and the char password to a file. By the way, sorry for using the goto statement, it's temporary because it's just faster than making while loops, and I will definitely remove it. Also, I'm not sure which of the libraries I have included I need, so if I don't need one of them please let me know and I'll remove it.

#include <iostream>
#include <time.h>
#include <cstring>
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <string>
using namespace std;

int main()
{

char username[10];
char password[20];
char confirmuser[2];
char confirmpass[2];

username:
cout << "Enter username. 10 char max." << endl;
cin >> username;
cout << "Confirm '" << username << "' as your username." << endl;
cout << "Y or N" << endl;
cin >> confirmuser;

if(!stricmp(confirmuser, "Y"))
{
system("cls");
goto password;
}

else if(!stricmp(confirmuser, "N"))
{
cout << "no" << endl;
Sleep(1000);
system("cls");
goto username;
}

else
{
cout << "Failed. Enter valid information." << endl;
Sleep(2000);
system("cls");
goto username;
}

password:
cout << "Enter password. 20 char limit." << endl;
cin >> password;
cout << "Confirm '" << password << "' as your password." << endl;
cout << "Y or N" << endl;
cin >> confirmpass;

if (!stricmp(confirmpass, "Y"))
{
system("cls");
goto infoprint;
}

else if (!stricmp(confirmpass, "N"))
{
cout << "no" << endl;
Sleep(1000);
system("cls");
goto password;
}

else
{
cout << "Failed. Enter valid information." << endl;
Sleep(2000);
system("cls");
goto password;
}

infoprint:

cout << "Username: " << username << endl << "Password: " << password << endl;
Sleep(20000);


}
Hi,
please use code tags
http://www.cplusplus.com/articles/jEywvCM9/

For saving from files you can start from here

http://www.cplusplus.com/reference/fstream/fstream/
also you can look up many resources available on internet

PS: you may also wanna use/learn structure or classes for your project
Topic archived. No new replies allowed.