Turning Turtle Game

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;

    cout << "Enter Size of Coin Position Sequence : ";
    cin >> n;

    char ch[n];

    int xor_sum = 0;

    cout << "Enter Each Coin Position : ";
    for(int i=0; i<n; i++)
    {
        cin >> ch[i];

        if(ch[i] == 'H')
            xor_sum ^= (i+1);
    }

    if(xor_sum > 0)
        cout << "First Player Win." << "\n";
    else
        cout << "Second Player Win." << "\n";

    return 0;
}

Comments