double quotation mark

Hi,

Could anyone please tell me how to make the output the double quotation mark"" in the following code?

Only if I change that to single quotation mark 'dog', the problem can be sloved. But if I want to use "dog", how do I make it?

Many thanks!


1
2
3
4
5
6
 #include <iostream>
int main ()
{
    std::cout << " "dog" ";
    return 0;
}
Last edited on
You will need to escape the quotation mark.
http://en.cppreference.com/w/cpp/language/escape

 
std::cout << " \"dog\" ";


Or you can use std::quoted
 
std::cout << std::quoted( " dog " );

http://en.cppreference.com/w/cpp/io/manip/quoted
Thank you very much for your help, integralfx.
Topic archived. No new replies allowed.