I've been working on another RPG, except on this one, I'm building it specificly to be used by me or someone else as an engine. I've got some code to compile, but when I run it, Windows politiely crashes the program. I am using VC++6, on Windows98. Here's the code:

Code:
#include <iostream.h>
#include <stdlib.h>
#include <windows.h>
#include <dos.h>
#include <conio.h>
#include <stdio.h>
#include <time.h>

void cls()
{
 COORD coordScreen = { 0, 0 };
 DWORD cCharsWritten;
 CONSOLE_SCREEN_BUFFER_INFO csbi;
 DWORD dwConSize;
 HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
 GetConsoleScreenBufferInfo(hConsole, &csbi);
 dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
 FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
 GetConsoleScreenBufferInfo(hConsole, &csbi);
 FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
 SetConsoleCursorPosition(hConsole, coordScreen);
}

void Assign(char a[10], char b[10]) {
 int times;
 do {
  a[times] = b[times];
  times++;
 } while (times != 10 || a[times + 1] == NULL);
}

void Randomize() {
 srand(time(NULL));
}

int Rand(int par1) {
 return (rand() % par1);
}

struct Spell {
 int power;
 bool enabled;
};

class Enemy {
 public:
  int str, def, lev;
  int ehp, ehpmax;
  char ename[20];
  void Set(int s, int d, int l);
};

void Enemy::Set(int s, int d, int l) {
 Randomize();
 ehpmax = Rand((s + d) * 2);
 ehp = ehpmax;
}

class Player {
 public:
  int str, def, mag, lev, luck;
  int exp, nlev, expadd, mp, hp, mpmax, hpmax, mexp;
  Spell fire1, water1, ice1, fire2, water2, ice2;
  char name[20];
  void Roll(int skill);
};

Player One;
Enemy Orc;
int dam;

void Player::Roll(int skill) {
 Randomize();
 lev = Rand(skill + 4) + 1;
 str = Rand(lev) + 1;
 def = Rand(lev) + 1;
 mag = Rand(lev) + 1;
 luck = Rand(luck) + 2;
 exp = 0;
 nlev = ((100 * lev) + Rand(100));
 Randomize();
 hpmax = Rand((lev + (str * 2) + (def * 3)));
 hp = hpmax;
 Randomize();
 mpmax = Rand((lev + (mag * 2)));
 mp = mpmax;
 mexp = 0;
 fire1.enabled = true;
 fire1.power = 2;
 water1.enabled = true;
 water1.power = 2;
 ice1.enabled = true;
 ice1.power = 2;
 fire2.enabled = false;
 fire2.power = 5;
 water2.enabled = false;
 water2.power = 5;
 ice2.enabled = false;
 ice2.power = 5;
}

bool DieEval(int hpleft, int damage) {
 if (hpleft < damage) {
  return true;
 } else {
  return false;
 }
}

void EndBattle(Player Guy) {
 cout << "This part is almost done...\n";
}

void Death() {
 cout << "You have died...\n";
}

void EAtt(Enemy EAtt, Player EDefen) {
 Randomize();
 dam = 0;
 dam = (Rand((EAtt.lev + 2 + EAtt.str - EDefen.def)));
 if (DieEval(EDefen.hp, dam) == true) {
  Death();
 } else {
  cout << EAtt.ename << " did " << dam << " points of damage.\n";
  getch();
  cls();
 }
}

void PAtt(Player Att, Enemy Defen) {
 Randomize();
 dam = 0;
 dam = (Rand((Att.lev + 2 + Att.str - Defen.def)));
 if (DieEval(Defen.ehp, dam) == true) {
  EndBattle(Att);
 } else {
  cout << Att.name << " did " << dam << " points of damage.\n";
  getch();
  cls();
  EAtt(Orc, One);
 }
}

void BMenu(Player Play, Enemy Enem) {
 int choice;
 do {
  cout << "Your HP: " << Play.hp << "/" << Play.hpmax << " Your MP: " << Play.mp << "/" << Play.mpmax << "\nEnemy HP: " << Enem.ehp << "/" << Enem.ehpmax << endl;
  cout << "\nBattle Menu:\n[1] Attack\n[2] Cast Spell\n>";
  cin >> choice;
  if (choice == 1) {
   PAtt(Play, Enem);
  } 
 } while (Play.hp > 0 && Enem.ehp > 0);
}


void main() {
 cls();
 printf("RPG V0.1\n");
 Sleep(1000);
 Assign("Scott", One.name);
 One.Roll(5);
 Orc.Set(3,3,3);
 Assign("Orc", Orc.ename);
 BMenu(One, Orc);
}
I know it's not totally complete yet. (I.E. I need to put in the magic!) but I'm workin on it. Any help would be nice.

Thanks, Valar_King