comment style in Visual Studio 2017

天涯浪子 提交于 2019-12-10 11:28:58

问题


I want to select a piece of code in Visual Studio 2017 and comment it. I know I can use CTRL + K, C, but the result is:

    /*fstream in("c:\\users\\hp\\documents\\visual studio 2017\\projects\\inputfile.in");
    if (!in)
    {
        cerr << "can't open input file\n";
        return 1;
    }
    fstream out("outputfile.out", fstream::out);
    if (!out)
    {
        cerr << "can't open output file\n";
        return 1;
    }*/

and what I actually want is

    //fstream in("c:\\users\\hp\\documents\\visual studio 2017\\projects\\inputfile.in");
    //if (!in)
    //{
    //    cerr << "can't open input file\n";
    //    return 1;
    //}
    //fstream out("outputfile.out", fstream::out);
    //if (!out)
    //{
    //    cerr << "can't open output file\n";
    //    return 1;
    //}

How do I do this?
I searched the internet, but I didn't find the answer to this question.


回答1:


I found myself the answer, but I can explain it only using screenshots.
So if I want to use the /.../ style, I select the code like this:

And if I want to use the // style, I select the code like this:



来源:https://stackoverflow.com/questions/44550156/comment-style-in-visual-studio-2017

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!