using namespace std;
ofstream outfile; // creating object named outfile
outfile.open("Example.txt"); // creating text file named example(specify extension as ".txt" in this case)
outfile << "Hello how are you , Have a nice day!"; /* The data that you want to enter to your created file.
You can also use "FOR loop" while using character array */
outfile.close(); // Closing the FILE (IT IS VERY IMPORTANT TO CLOSE IT !!)