Are you the chosen one? (with rand())

#include <iostream>

void AreYouTheChosenOne()
{
    std::cout << std::endl;
    std::cout << "\n\n                     .ed**** ***$$$$be.                    \n" ;       
    std::cout << "                   -*           ^****$$$e.                 \n" ;
    std::cout << "                .*                   *$$$c                 \n" ;
    std::cout << "                /                      *4$$b               \n" ;
    std::cout << "               d  3                      $$$$              \n" ;
    std::cout << "               $  *                   .$$$$$$              \n" ;
    std::cout << "              .$  ^c           $$$$$e$$$$$$$$.             \n" ; 
    std::cout << "             d$L  4.         4$$$$$$$$$$$$$$b              \n" ;
    std::cout << "              $$$$b ^ceeeee.  4$$ECL.F*$$$$$$$             \n" ;
    std::cout << "  e$**=.      $$$$P d$$$$F $ $$$$$$$$$- $$$$$$             \n" ;
    std::cout << " z$$b. ^c     3$$$F *$$$$b   $*$$$$$$$  $$$$**      .=**$c \n" ;
    std::cout << "4$$$$L        $$P*  *$$b   .$ $$$$$...e$$        .=  e$$$. \n" ; 
    std::cout << "^*$$$$$c  %..   *c    ..    $$ 3$$$$$$$$$$eF     zP  d$$$$$\n" ;
    std::cout << "  ***$$$ec   *   |ce**    $$$  $$$$$$$$$$*    .r* =$$$$P** \n" ;
    std::cout << "        **$b.  *c  *$e.    *** d$$$$$*L$$    .d*  e$$****  \n" ;
    std::cout << "          ^*$$c ^$c $$$      4J$$$$$% $$$ .e**.eeP*        \n";
    std::cout << "             *$$$$$$*'$=e....$*$$**$cz$$* *..d$**          \n";
    std::cout << "               **$$$  *=%4.$ L L$ P3$$$F $$$P*             \n";
    std::cout << "                  *$   *||ebJLzb$e$$$$$b $P*               \n";
    std::cout << "                    %..      4$$$$$$$$$$ *                 \n";
    std::cout << "                     $$$e   z$$$$$$$$$$%                   \n";
    std::cout << "                      **$c  *$$$$$$$P*                     \n";
    std::cout << "                       .****$$$$$$$$bc                     \n";
    std::cout << "                    .-*    .$***$$$****e.                  \n";
    std::cout << "                 .-*    .e$*     **$c  ^*b.                \n";
    std::cout << "          .=*****    .e$**          **bc  **$e..           \n";
    std::cout << "        .$*        .z**               ^*$e.   ******e.     \n";
    std::cout << "        $$ee$c   .d*                     **$.        3.    \n";
    std::cout << "        ^*$E*)$..$*                         *   .ee==d%    \n";
    std::cout << "           $.d$$$*                           *  J$$$e*     \n";
    std::cout << "            *****                              *$$$*       \n";
    std::cout << "\n\nAre you the chosen one...\n";
    std::cout << "So you are the one supposed to defeat. Humans are really pitiful creatures...\n";
    std::cout << "Clear my dungeon if you are really the chosen...\n" ;




    
}

void PlayIntroduction(int Difficulty)
{
    
     std::cout << "To clear Dungeon " << Difficulty << ", Answer the following..." << std::endl ;

}

bool PlayGame(int Difficulty)
{
    
    PlayIntroduction(Difficulty);
    const int CodeA = rand(); 
    const int CodeB = rand();
    const int CodeC = rand();

    const int CodeSum = CodeA + CodeB + CodeC; 

    const int CodeProduct = CodeA * CodeB * CodeC; 

    std::cout << std::endl;
    std::cout <<"Your clues are...\n" ;
    std::cout << "The numbers add-up to..." << CodeSum << std::endl ; // print sum
    std::cout << "The numbers multiply to give..." << CodeProduct << std::endl ; // print product

    int GuessA, GuessB, GuessC;
    
    int GuessSum, GuessProduct;

    std::cin >> GuessA >> GuessB >> GuessC ;
    

    GuessSum = GuessA + GuessB + GuessC;
    GuessProduct = GuessA * GuessB * GuessC;

    if (GuessSum == CodeSum && GuessProduct == CodeProduct)
    {
        std::cout <<"You are not completely useless. Keep trying, heavens want to test you more. \n\n";

        return true;
    }
    else
    {
        std::cout <<"The heavens have give you another chance. STAND UP! TRY AGAIN! \n\n";

        return false;
    }
    


}

int main()
{
    AreYouTheChosenOne();
    int LevelDifficulty = 1 ;
   

    int const MaxDifficulty = 5;

    while (LevelDifficulty <= MaxDifficulty)
    {
        bool bLevelComplete = PlayGame(LevelDifficulty) ;
        std::cin.clear();
        std::cin.ignore();
        
        if (bLevelComplete)
        {
            ++LevelDifficulty;
        }
        
    }

    std::cout << "HEAVENS ARE ON YOUR SIDE, HUMAN. BUT I WILL RETURN. AAAAAAAAAHHHHHHHH! ";

    return 0;
}

   
1 Like

I am the chosen one :sunglasses:

Privacy & Terms