//include needed libraries
#include <iostream>
#include <string>

//define print functions
#define printl(x) std::cout << x << std::endl;
#define print(x) std::cout << x;

//get answer function
std::string getAnswer(int firstNum, int secondNum) {
	//if the number is less than the other number, return respected letter
	if (firstNum < secondNum) {
		return "H";
	}
	else {
		return "L";
	}
}

//main function
int main() {
	//define array to store player 1's input
	std::string player1Input[7];
	printl("Player 1, please enter 7 values");
	//loop through 7 times, and take player 1's input
	for (int i = 0; i < sizeof(player1Input); i++) {
		print("Enter Number " << i + 1 << " > ");
		std::getline(std::cin, player1Input[i]);
	}
	//print the first value of the array to player 2
	printl("Player 2, the first value is " << player1Input[0]);
	//loop through 7 times
	for (int i = 0; i < sizeof(player1Input); i++) {
		//define variable to store player 2's input
		std::string player2Input;
		//get the current answer in rotation
		std::string answer = getAnswer(std::stoi(player1Input[i]), std::stoi(player1Input[i + 1]));
		//get player 2's input
		print("Higher (H) or Lower (L) > ");
		std::getline(std::cin, player2Input);
		//check to see if player 2's input is correct
		if (player2Input == answer) {
			//if the loop is at the end of the array
			if (i == 5) {
				printl("Player 2 wins!");
				break;
			}
			else {
				printl("Correct! The next value is " << player1Input[i + 1]);
			}
		}
		else{
			//tell Players that player 1 has won, and break from the loop
			printl("Incorrect, sorry player 1 wins!");
			break;
		}
	}
	//pause cmd
	system("PAUSE");
	return 0;
}