Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #define MAX_HEALTH 500
- #define MAX_ATTACK 50
- #define MIN_ATTACK 1
- using namespace std;
- void startGame(){
- int health, attack;
- begin:
- cout << "Welcome!\n";
- health = MAX_HEALTH;
- attack = MIN_ATTACK;
- while(health>0){
- cout << health << "\t- " << attack << "\t= ";
- health -= attack;
- cout << health << endl;
- attack++;
- }
- cout << "You Died!\n";
- }
- int main(){
- char blue[] = "\x1b[1;34m\0";
- char normal[] = "\x1b[0;39m\0";
- char choice;
- start:
- cout << blue << "#########################################" << normal << endl;
- cout << blue << "#" << normal << " Welcome to a quick battle test! :) " << blue << "\t#" <<normal << endl;
- cout << blue << "#" << normal << " 20/01/2014 03:10 AM" << blue << "\t\t#" << normal << endl;
- cout << blue << "#########################################" << normal << endl;
- else1:
- cout << "\n------ Press (S)tart or (E)xit ------" << endl;
- cin >> choice;
- if (choice == 'S' || choice == 's')
- startGame();
- else if(choice == 'E' || choice == 'e'){
- cout << "\nAre you sure you want to quit?\n(Y/N): ";
- cin >> choice;
- if (choice == 'Y' || choice == 'y')
- cout << "OK bye bye!" << endl;
- else if (choice == 'n' || choice == 'N')
- goto start;
- }else{
- cout << "Please choose Yes or no" << endl;
- goto else1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement