Skip to content

Instantly share code, notes, and snippets.

@Bojne
Created November 8, 2015 15:55
Show Gist options
  • Save Bojne/f921426be7b2f29a9e79 to your computer and use it in GitHub Desktop.
Save Bojne/f921426be7b2f29a9e79 to your computer and use it in GitHub Desktop.
同學的程式
#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
int main()
{
int monlife[5];
int action, target;
srand(time(NULL));
for(int a=0; a<5; a++)
{
monlife[a] = (rand()%200000)+1000000;
}
while(true)
{
cout << "///// MONSTER HUNTING GAME \\\\\ " << '\n' << endl;
for(int i=0; i<5; i++)
{
cout << "Monster[" << i+1 << "] ----> " ;
if( monlife[i] < 1)
{
cout << "-DEAD-" ;
}
else
{
cout << monlife[i] ;
}
cout << endl;
}
cout << "---------------" << endl;
cout << "Your action : " << endl;
cout << "(1) Normal Attack" << endl;
cout << "(2) AOE" << endl;
cout << "(3) HERO SKILL" << endl;
cout << "(4) GIVE UP" << endl;
cin >> action;
switch (action)
{
case 1:
cout << "Select ---> " ;
cin >> target;
monlife[target-1] -= (rand()%9000)+50000;
break;
case 2:
for(int i=0; i<5; i++)
{
monlife[i] -= (rand()%8000)+30000;
}
break;
case 3:
cout << "Select ---> " ;
cin >> target;
monlife[target-1] -= 1000000;
for(int i=0; i<=1000; i++)
{
cout << "ENERGY " << i << "%";
system("cls");
}
for(int j=0; j<300; j++)
{
cout << "OVER LOAD !!!" ;
system("cls");
}
break;
case 4:
system("cls");
for(int i=0; i<=9000; i++)
{
cout << "You can't give up HA HA !!" << endl;
}
break;
case 5:
for(int j=0; j<300; j++)
{
cout << "THE DOOR IS OPENING!!!!!" ;
system("cls");
}
for(int i=0; i<5; i++)
{
monlife[i] -= 10000000;
}
break;
}
/////////////////////////////////
/////////////////////////////////
system("cls");
if(action == 7)
{break;}
}/////while end
system("PAUSE");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment