Hi.
Firstly, I am a complete noob, and cannot understand complicated answers.

OK. I'm making a noobish space game, called Galactic Armageddon.
I'm just testing the variables right now (for getting hit by lasers, missiles, etc.).

I'm compiling using Dev-C++ and the default compiler. The program is written using the Allegro game library (see cppgameprogramming.com)

When I run the executable, I get an error saying:

GA.exe has encountered a problem and needs to close.

It says this straight away, without even opening a window or anything.

Here is the code so far:

#include <cstdlib>
#include <iostream>
#include <allegro.h>

using namespace std;

int  bullethit 	=   0;
int  health     =   100;
int  shield    	=   10;
int  maxshield 	=   10;
int  armour    	=   10;
int  maxarmour 	=   10;
int  dir      	=   0;
int  weapon     =   0;
bool shieldsup 	= true;
bool armourup  	= true;
bool dead	    = false;
bool running    = true;
     
void ship(){
			
		if (dir < 0)
		  {
			dir=360;
		  }

		else if (dir > 360)
		  {
			dir=0;
		  }

		if (bullethit==1 &&  shieldsup==false && armourup==false)
		  {
			health = health - 10;
			bullethit    =     false;
		  }
		
		if (bullethit==1 &&  shieldsup==false && armourup==true)
		  {
			armour = armour - 5;
			bullethit    =     false;
		  }

		if (bullethit==1 && shieldsup==true)
		  {
			shield = shield - 4;
			bullethit = false;
		  }

		if (bullethit==2 && shieldsup==false && armourup==false)
		  {
			health =  health - 20;
			bullethit    =      false;
		  }

		if (bullethit==2 && shieldsup==false && armourup==true)
		  {
			armour = armour - 10;
			bullethit    =      false;
		  }

		if (bullethit==2 && shieldsup == true)
		  {
			shield = shield - 8;
			bullethit = false;
          }

		if (bullethit==3 && shieldsup==false && armourup==false)
		  {
			health = health - 30;
			bullethit    =     false;
		  }
		
		if (bullethit==3 && shieldsup==false && armourup==true)
		  {
			armour = armour - 15;
			bullethit    =     false;
		  }

		if (bullethit==3 && shieldsup==true)
		  {
			shield = shield - 12;
			bullethit = false;
		  }

		if (bullethit==4 && shieldsup==false&&armourup==false)
		  {
			health = health - 40;
			bullethit = false;
		  }

		if (bullethit==4 && shieldsup==false&&armourup==true)
		  {
			armour = armour - 20;
			bullethit = false;
		  }

		if (bullethit==4 && shieldsup)
		  {
			shield = shield - 17;
			bullethit = false;
		  }


		if (bullethit==5 && shieldsup==false&&armourup==false)
		  {
			health = health - 45;
			bullethit = false;
		  }
		
		if (bullethit==5 && shieldsup==false&&armourup==true)
		  {
			armour = armour - 22;
			bullethit = false;
		  }
		
		if (bullethit==5 && shieldsup==true)
		  {
			shield = shield - 20;
		  }

		if (bullethit==6)
		  {
			shield	=0;
			armour	=0;
			health	=0;
		  }

		if (health==0)
		  {
			dead=true;
		  }
		
		if (armour==0)
		  {
			armourup = false;
		  }

		if (shield==0)
		  {
			shieldsup = false;
		  }
		
		if (dead==true)
		  {
            clear_to_color( screen, makecol( 0, 0, 0));
			textout_ex( screen, font, "You are dead!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0));;
		  }

		if (armourup==false)
		  {
            clear_to_color( screen, makecol( 0, 0, 0));
			textout_ex( screen, font, "No more armour!", 320, 240, makecol( 255, 0, 0), makecol( 0, 0, 0));;
		  }

		if (shieldsup==false)
		  {
            clear_to_color( screen, makecol( 0, 0, 0));
			textout_ex( screen, font, "No more shields!", 320, 240, makecol( 255, 0, 0), makecol(0, 0, 0));;
		  }

        while (!key[KEY_ESC]){
            clear_to_color( screen, makecol(0, 0, 0));
			textout_ex( screen, font, "Shields:  " + shield, 320, 240, makecol(255, 0, 0), makecol(0, 0, 0));;
			textout_ex( screen, font, "Armour :  " + armour, 320, 230, makecol(255, 0, 0), makecol(0, 0, 0));;
			textout_ex( screen, font, "Health:   " + health, 320, 220, makecol(255, 0, 0), makecol(0, 0, 0));;
		  }
	}
	
void testattack(){
     int weapon;
			cout<<"1=laser 2=cannon 3=part 4=missile 5=homing 6=NUKE"<<endl;
			cin>>weapon;
                    bullethit=weapon;
                    ship();
		  }

#undef main
		  
int main(int argc, char* argv[]){
      while(running==true)
      {
       testattack();
      }
      return 0;
}

Please help me!

Thanks
Mark