All pastes #92010 Raw Edit

dgonik

public cpp v1 · immutable
#92010 ·published 2006-07-19 03:23 UTC
rendered paste body
#include <iostream>#include "spaceship.cpp"using std::cin;using std::cout;using std::endl;enum MenuOption{Attack = 1,FixDamage = 2,Status = 3};string OptNames[] = {"Attack", "Fix Damage", "Status"};MenuOption DoMenu;{	for(int i = 0; i <= 3; i++)			cout<<i+1<<"-"<<OptNames[i]<<endl;		cout<<"What do you want to do?"<<endl;	cin>>ans;	return ans;}    int main(){string PName;//Remembers the numbers inputed by the user//int MaxDamage = 30;int ant = 3;int amnt = 3;const int Num_Enemies = 2;int LP = 0;int HS = 0;int MaxD = 0;int ans;srand(static_cast<unsigned int>(time(NULL)));//returns a value of the time_t type and srand() takes a parameter of unsigned int type//Roller oneToTwenty(1, 20);//Create objects//int Roll = oneToTwenty.GetRoll();//Declare Roll and set it equal to random numbers//Spaceship spaceship1();//create spaceship object//cout<< "Please enter your name: "<<;//Ask user to enter information to remember//cin>>PName;//Pilot Name//    Spaceship enemies[Num_Enemies];    enemies[0].setPilotName("Death Star");    enemies[0].setHullStrength(0);    enemies[0].setMaxDamagePoints(20);    enemies[0].setLaserPower(0);    enemies[1].setPilotName("Shrek");    enemies[1].setHullStrength(1);    enemies[1].setLaserPower(1);    enemies[1].setMaxDamagePoints(30);	enemies[2].setPilotName("Captain Buzz");	enemies[2].setHullStrength(2);	enemies[2].setMaxDamagePoints(40);	enemies[2].setLaserPower(2);		    for (int currEn=0; currEn<=2; currEn++)    {        while(!(spaceship1.IsDead())&&!(enemies[currEn].IsDead()))                        MenuOption(DoMenu(spaceship1.GetName()));        switch(ans)        {        case AttackOpt:			enemies[curEn].IsHit(Roll);			if (enemies[curEn].IsHit(r.getRoll())			{				Roller Attack(1,(spaceship1.getLaserPower + 2));				int rol = Attack.getRoll();				emenies[curEn].GiveDamage(rol );			}			else				cout<<"You have missed the enemy!"<<endl;            break                case FixOpt;				Roller Attack(1,(spaceship1.getHullStrength() + 2));				int rol = Attack.getRoll();			    spaceship1.FixDamage(rol);            break        case Status_opt:			spaceship1.PrintStats();			continue;            break;        }	Roller Enemy(1,2);	int en = Enemy.GetRoll();	while(!(spaceship1.IsDead())&&!(enemy[currEn].IsDead()))                  switch(en)        {        case AttackOpt:			spaceship1.IsHit(Roll);			if (spaceship1.IsHit(r.getRoll())			{				Roller Attack(1,(enemies[curEn].getLaserPower + 2));				int rol = Attack.getRoll();				spaceship1.GiveDamage(rol );			}			else				cout<<"He missed You!"<<endl;            break                case FixOpt;				Roller Attack(1,(enemies[curEn].getLaserPower + 2));				int rol = Attack.getRoll();			    enemies[curEn].FixDamage(rol);            break;             }		if(!(spaceship1.IsDead())&&!(enemy[currEn].IsDead()))			continue;		else		{			if(spaceship1.IsDead())				cout<<"The enemy has defeated you, better luck next time!"<<endl;			else			{				spaceship1.UpgradeHull(ant);				spaceship1.UpgradeLaser(amnt);				spaceship1.setCurrentDamagePoints()				cout<<"Good job!  Because of your glorius battle, I have given you a new ship, check out the stats: "<<endl;				spaceship1.PrintStats();			}		}	}	return 0;	}