How does your Triple X game start?

Hello, on void PrintIntroduction, at the begining of the TRIPLE X. if i want that the coments are just printed one time, just at the start of the game, how we can do this?
The traning is no fnished and maybe we can see it later, but i’m curious

Thank you
Roby

Screenshot 2021-12-01 010412

Here is a screenshot of my TripleX game so far. Please be aware that this game contains threats of violence.

#include <iostream>

int main()
{
    // Print to terminal the story setup
    std::cout << "+ I've known a few guys who thought they were pretty smart";
    std::cout << std::endl;
    std::cout << "+ But you've got being right down to an art";
    std::cout << std::endl << std::endl;
    std::cout << "+ You think you're a genius, you drive me up the wall";
    std::cout << std::endl;
    std::cout << "+ Well figure out this 3 number code, you know-it-all! ";

    // Declare the three number code as a constant
    const int CodeA = 4;
    const int CodeB = 3;
    const int CodeC = 2;

    // Calculations using the code to offer as clue to the user.
    const int CodeSum = CodeA + CodeB + CodeC;
    const int CodeProduct = CodeA * CodeB * CodeC;

    // Print to terminal the clues.
    std::cout << std::endl << std::endl;
    std:: cout << "+ Oh-oo-oh, the sum is " << CodeSum << std::endl;
    std:: cout << "+ Oh-oo-oh, the product is " << CodeProduct << std::endl;

    int GuessA, GuessB, GuessC;
    std:: cout << "+ Okay, so type in your answers ... ";
    std:: cin >> GuessA;
    std:: cin >> GuessB;
    std:: cin >> GuessC;

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

    if (GuessSum == CodeSum && GuessProduct == CodeProduct)
    {
        std:: cout << std::endl << "+ That ... does impress me much.";
    }
    else
    {
        std:: cout << std::endl << "+ That don't impress me much.";
    }

    return 0;
}  

Here is the code after 2.23. I’ve modified the story to celebrate Canadian singer and songwriter and Queen of Country Pop, Shania Twain.

#include <iostream>
using namespace std;

int main()
{

  cout <<"you are a brave warrior and you must fight to free your country from the orcs...\n";
  cout <<"Your first battle is coming, to emerge victorious you must enter the right number... ";
    
    return 0;
}

}

Privacy & Terms