ok all I need is to do is put qoits in cout. Like cout<<"She said"this""; or something like that. It is not dissus able I need quotation marks in it. (makeing JavaScript thing from inside program with user imput.) Just tell me how to do it instead of alternative ways of doing it. Unless the only way isnt this.

Recommended Answers

All 5 Replies

Try the escape sequence \" e.g.

std::cout << "this is a quote \"" << std::endl;

Cool man. Now how do I put a plain \ in it.

Same way

Oh yeah will this work in ofstream ?

Oh yeah will this work in ofstream?

Yes. std::ofstream is a std::ostream.

C++11: Just use raw string literals.

std::cout << R"---(The path is "C:\Equation_MinGW\bin\g++.exe". (C++11))---" << '\n' ;

   std::cout << R"(menu
----
   1. one
   2. two
   3. three
   )" ;

See: http://www2.research.att.com/~bs/C++0xFAQ.html#raw-strings

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.