C++ output string without '\n' or endl will output '#' in the end of string

后端 未结 1 1315
滥情空心
滥情空心 2021-01-17 05:57

On ubuntu16.04, I use g++ to compile such code:

#include 

int main()
{
    std::cout << \"Hello World!\";
    return 0;
}
相关标签:
1条回答
  • 2021-01-17 06:27

    It doesn't, it's your bash prompt.

    You can reproduce your problem with echo:

    # echo "Hello, World!"
    Hello, World!
    # echo -n "Hello, World!"
    Hello, World!#
    
    0 讨论(0)
提交回复
热议问题