VScode C++ 一键注释

1.注释:

首选选中要注释的部分;

int main()
{
    using namespace std;
    cout << "Enter your weight: ";
    float weight;
    cin >> weight;
    string gain = "A 10% increase raises ";
    string wt = boost::lexical_cast (weight);
    gain = gain + wt + " to ";      // string operator()
    weight = 1.1 * weight;
    gain = gain + boost::lexical_cast(weight) + ".";
    cout << gain << endl;
    return 0;
    
}

先按下 Ctrl + K;

再按下 Ctrl + C;

int main()
{
    // using namespace std;
    // cout << "Enter your weight: ";
    // float weight;
    // cin >> weight;
    // string gain = "A 10% increase raises ";
    // string wt = boost::lexical_cast (weight);
    // gain = gain + wt + " to ";      // string operator()
    // weight = 1.1 * weight;
    // gain = gain + boost::lexical_cast(weight) + ".";
    // cout << gain << endl;
    // return 0;
    
}

2. 取消注释:

首选选中要取消注释的部分;

先按下 Ctrl + K;

再按下 Ctrl + U;

你可能感兴趣的:(vscode,c++,ide)