For example i want to write (rand%(MaxValue-MinValue+1))-MinValue
i don’t want to write this line everytime i want to use it but is there a way to make Visual Studio auto write it when i just need to write rand
or R
.
Question posted in Visual Studio Code
View the official documentation.
View the official documentation.
2
Answers
Why not use
#define
?Here is an example:
And to call it:
I recommend you to use snippet, it’s very convenient.
You need to create a new txt file on the desktop, and then enter the following code in the file.
Then change the suffix of the txt file to snippet, and finally import the snippet according to the method in the document.
RESULT: