How do you output the \ symbol using cout?

前端 未结 7 883
误落风尘
误落风尘 2020-12-10 05:32

How do you output \\ symbol using cout?

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-10 06:15

    The '\' character is an escape character in C and C++. You can output a literal '\' by escaping it with itself:

       cout << "This is a backslash: \\";
    

提交回复
热议问题