Cpp 2: Add A Code Snippet

‘Don’t Repeat Yourself’ Principle At Play (kind of)
coding
cplusplus
visual studio
Author

Tony Phung

Published

August 13, 2025

1. Introduction

Sick of typing std::cout everytime you want print to console?

  • I am.

2. Steps

2.1 [Step 1] Create a file

File suffix is:

  • “snippet” (e.g. cout.snippet)

I used Linux (Ubuntu on WSL):

  • touch cout.snippet

Windows, not sure how.

2.3 [Step 3] Add the snippet

Visual Studio -> Tools -> Code Snippets Manager -> Import: cout.snippet -> OK

2.4 [Step 4] Test It

In editor:

  • Type cout
  • Hit tab
  • It should output: std::cout << ;

If you have a problem, ask AI.

2.5 [Step 5] Calculate Profit [Optional]

All those seconds save, over a life-time:

  • Tell all your friends and family and
  • Pets
    • In fact, force your pets to watch you use the snippet.