Answers for "how to print string variable in c++"

C++
0

print string in c++

#include <iostream>
#include <string>
#include <iterator>

using std::cout; using std::cin;
using std::endl; using std::string;

int main(){
    string s1 = "This string will be printed";
    cout << s1;
    cout << endl;

    printf("%s", s1.c_str());
    cout << endl;

    return EXIT_SUCCESS;
}
Posted by: Guest on July-23-2021

Code answers related to "how to print string variable in c++"

Browse Popular Code Answers by Language