Well not including your non-adherance to the ANSI standard... this will do you...
Code:
#include <iostream.h>
#include <fstream.h>
#include <conio.h>
#include <string.h>
#define say cout
#define USHORT int
#define ZOO char
ZOO username[25];
USHORT desiredlives;
void write_to_file();
int main()
{
say << "Input your player's name: ";
cin >> username;
say << "\nOk " << username << ". How many lives do you want to start with? ";
cin >> desiredlives;
say << "\nThanks, thats all of the information we need." << endl;
say << "\n";
write_to_file();
getch();
return 0;
}
void write_to_file()
{
ZOO player[25];
strcpy (player, username);
USHORT lives=desiredlives;
ofstream fout;
fout.open("player.dat");
fout << "Player: " << player;
fout << "\nLives: " << lives;
fout.close();
}