Answers for "how to save string in text file cpp"

C++
0

c++ stream string into fiel

#include <fstream>
#include <string>
#include <iostream>

int main()
{
    std::string input;
    std::cin >> input;
    std::ofstream out("output.txt");
    out << input;
    out.close();
    return 0;
}
Posted by: Guest on July-03-2020
0

c++ write string

#include <iostream>

int main() {
	std::cout << "Hello" << std::endl; //endl = end line/new line
    // or
    printf("hello");
    
}
Posted by: Guest on March-02-2020

Code answers related to "how to save string in text file cpp"

Browse Popular Code Answers by Language