Let's take a look at your code.
Create an object of type Player, named pWeapon
Create an object of type int, named input
cout<<"Enter number of your weapon choice Rock = 1, Paper = 2, Scissors = 3:"<<endl;
Output some words to the screen.
cin >> input;
Get a value from the keyboard and store it in the variable named input.
Now call the class function setWeapon() on the Player object. This function takes no parameters, so we are passing it no information.
Let's follow to that function:
if(number >= 1 || number <= 3)
So now we compare the variable number
. What value does number
have? It is a class variable and you never gave it a value, so it will be some random number. It could be anything.
I am finding it difficult to assign the right value to number?
Here is how to assign a value to number.
number = 7;
This assigns the value 7 to number.
Here is another example:
number = x;
This assigns whatever the value of x is (in this example) to number.
Your code nowhere attempts to set the value of number. I think that right now classes are too advanced for you. You need to go back and learn:
1) Assigning values to things