#include <iostream>
#include <sstream>
#include <string>
 
//define Print as std::cout
#define Print(x) std::cout << x;
 
int main() {
    /* Define needed variables */
    bool game = true;
    bool once = false;
    std::string PlayerOneValues[7];
    std::string truth;
    std::string answer;
    std::string exit;
    /* Start infinite loop */
    while (game)
    {
        /* Ask player 1 to input 7 numbers */
        Print("Player 1 please enter 7 numbers" << std::endl);
 
        /* loop 7 times for player 1 to input numbers */
        for (int i = 0; i < 7; i++){
            Print("Enter Number " << i + 1 << " > ");
            /* Assign player 1 input to array */
            std::getline(std::cin, PlayerOneValues[i]);
        }
 
        /* Loop another 7 times */
        for (int i = 0; i < 7; i++) {
            /* if the variable once is false print the first number to the player*/
            if (once == false){
                Print("Player 2 the first number is " << PlayerOneValues[i] << std::endl);
                /* set once to true */
                once = true;
            }else {
                /* Ask player 2 if the number is higher or lower */
                Print("Higher (H) or Lower (L) > ");
                /* Assign player 2's input as answer */
                std::getline(std::cin, answer);
 
                /* check if the number is actually higher or lower*/
                if (PlayerOneValues[i - 1] < PlayerOneValues[i]) {
                    truth = "H";
                }
                else if (PlayerOneValues[i - 1] > PlayerOneValues[i]) {
                    truth = "L";
                }
 
                /* check player 2's input to the actual answer*/
                if (answer == truth) {
                    Print("Correct, next value is " << PlayerOneValues[i] << std::endl);
                }
                else {
                    Print("Incorrect, Player 1 Wins!" << std::endl);
                    /* break from the loop and infinite loop */
                    game = false;
                    break;
                }
            }
        }
        /* Ask player's if they want to play again */
        Print("Want to Try Again? (Y) (N) > " << std::endl);
        /* get players input */
        std::getline(std::cin, exit);
        /* check if the players input was yes*/
        if (exit == "Y") {
            continue;
        }
        else {
            game = false;
        }
    }
    /* pause cmd */
    system("pause");
    return 0;
}