How to declare a string with double quote substrings in C++

1 Answer

0 votes
#include <iostream>
#include <string>

int main() {
    // Declare a string with double quotes inside
    std::string str = "This is a string with \"double-quoted substring1\", and \"double-quoted substring2\" inside.";
    
    std::cout << str << std::endl;
}

 
 
/*
run:
 
This is a string with "double-quoted substring1", and "double-quoted substring2" inside.
 
*/

 



answered May 12 by avibootz
...