This is an example of a code snippet with highlighted syntax
using namespace std;
void printIntro();
void getGuessAndPrintIt();
int main() //entry point of the game
{
constexpr int MAX_TRIES = 5;
printIntro();
for (int count = 1; count <= MAX_TRIES; count++)
{
getGuessAndPrintIt();
}
return 0;
}
void printIntro() //print the intro text
{
constexpr int WORD_LENGTH = 9;
cout << "Welcome to Bulls & Cows, a freaking awesome game by Mornarion.\n";
cout << "Try to guess the " << WORD_LENGTH;
cout << " letters isogram that I'm thinking... If you dare!!!\n\n";
return;
}
void getGuessAndPrintIt() //get a guess from player
{
string Guess = "";
cout << "What is your guess?: ";
getline(cin, Guess);
//return the guess to the playa
cout << "Your guess is: " << Guess << endl << endl;
return;
}
to do this you have to add the code this way without using preformated text
- Start your code with " ```c++ " (without the double quotes of course) , this is markdown syntax which points that start of your code snippet and which language you use for syntax highlighting
- copy paste your code
- close the code snippet with " ``` " (again without double quotes)
be careful its ` not ’ , ` is located in the same key with ~ , at least on my keyboard
Basically the forum supports markdown , its syntax you can find here