//technical stuff
#include <iostream>
#include <cstdlib>
#include <sstream>
#include <conio.h>
#include <stdio.h>
#include <ctype.h>
using namespace std;

string entry(){
    string input = "";
    char ch = getch();
    while (ch != '\r'){
        if (ch == '.'){
            cout<<ch;
            ch=getch();
        }
        else if (ch == '\b'){
            cout<<'\b';
            input.resize((input.length()-1));
        }
        else {
            ch = tolower(ch);
            input += ch;
            cout<<ch;
            ch = getch();
        }
    }
    cout << "\n"+input;
    string letsee = input;
    return letsee;
}

void actual(){
    //prints welcome message to console
    cout << "Welcome to this annoying game C & D like to play on long car trips!\n";
    //infinite loop (this game goes on forever. Literally.
    while (1<2){
        //first question
        cout << "\n\nGuess what?  ";
        //creates all variables (inputs and answers and all that jazz)
        string a1, a2, a3, c2, c3, pc2, pc3, complaint;
        string bollucks[]={"you die","You die.","chicken pie","Chicken pie.","cow pie","Cow pie.","mud pie","Mud pie."};
        a1=entry(); //make it so that it's lower-case
        if (a1 == "chicken butt"){
            cout << "\nGuess who?  ";
            int temp = rand() % 2;
            if (temp == 1){
                c2 = "chicken poo";
                pc2 = "Chicken poo.";
            }
            else{
                c2 = "it's you";
                pc2 = "It's you.";
            }
            a2=entry();
            if (a2==c2){
                cout << "\nGuess why?  ";
                a3= entry();
                int temp2 = rand() % 4;
                c3= bollucks[temp2];
                pc3= bollucks[(temp2+1)];
                if (a3==c3){
                    cout<<"\nRight.";
                }
                else {
                    cout<<"\nWrong. "+pc3;
                    cout<<"\nEnter your complaint:  ";
                    complaint = entry();
                }
            }
            else{
                cout << "\nWrong. "+pc2;
            }
        }
        else{
            cout<< "\nWrong. Chicken butt.";
        }
    }
}

//main function
int main(){
    actual();
    return 0;
}
