Created
April 1, 2022 21:49
-
-
Save CodeMaster7000/c32bd587233d36f9dd1d662deff5807b to your computer and use it in GitHub Desktop.
A simple file generator coded in C++.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main () { | |
string fileName; | |
string fileType; | |
string fileText; | |
cout << "Please enter the information in the file >"; | |
getline(cin, fileText); | |
cout << endl << "Enter file name >"; | |
cin >> fileName; | |
cout << endl << "Enter file type (i.e .txt, .exe, .cpp) >"; | |
cin >> fileType; | |
ofstream myfile; | |
myfile.open (fileName + fileType); | |
myfile << fileText; | |
myfile.close(); | |
cout << endl << "Now go and check out the file next to main.cpp"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment