Skip to content
Permalink
Browse files
My contribution towards the project
  • Loading branch information
cmomodo committed Apr 15, 2021
1 parent 5d65b0a commit 3934bd13dc5481db51073d3864ebc2c3de89679a
Showing 1 changed file with 61 additions and 0 deletions.
@@ -0,0 +1,61 @@
#include <iostream>
#include <string>
using namespace std;

class player
{
string playerClass;
int level;
int attack;

public:
int hp;
int mp;
int experience;

player(int choice) {
if (choice ==1) {playerClass = "Warrior";
level = 1;
attack = 60;
hp = 100;
mp = 10;
experience = 0;
}
if (choice == 2) {playerClass = "Wizard";
level = 1;
attack = 20;
hp = 100;
mp = 100;
experience = 0;
}
if (choice == 3) {playerClass = "Archer";
level = 1;
attack = 40;
hp = 100;
mp = 30;
experience = 0;
}

}
string printClass() {
return playerClass;
}
};

int main() {
cout << "choose your character class. \n[1] Warrior [2] Wizard [3] Archer ; ";
int choice;
cin>>choice;

while (!cin >> choice || choice > 3 || choice < 1) {
cout << "Not a valid choice. \nChoose your character class. \n[1] Warrior [2] Wizard [3] Archer : ";
}

player character(choice);

cout << "\nwelcome " << character.printClass() << ".Let's begin your adventure. " <<endl;

cin.ignore();
cin.get();
return 0;
}

0 comments on commit 3934bd1

Please sign in to comment.