When the input is between 100 to 200 I want the output to be "steal", when the input is 1 or 0 I want the output to be "steal". And when the input is 0.5 I want the output to be "split".
I have the first two parts correct but cant seem to get the 0.5 part correct...please helpp
int main ()
{
int x;
cout << "Please enter an integer value: ";
cin >> x;
if ((x >= 100) && (x < 200)) // I will start the game with a steal.
{cout << "steal";}
else if (x == 0 ||x == 1 ) // if the result was 0, I will steal. if the result was 1, I will steal.
{cout << "steal";}
else
{cout << "split";} // if 0.5 = split
0.5 is a decimal value. C/C++ int's can't store anything other than whole numbers. You either need to change x to a float or double, or need to use a value other than .5.
Well, you have two options here. You can learn about file streams, which is the proper way to go, or you can alter stdin to accept from a file, which is the easy way to go. For example: