Skip to content

Instantly share code, notes, and snippets.

@CodeMaster7000
Created April 1, 2022 21:49
Show Gist options
  • Save CodeMaster7000/c32bd587233d36f9dd1d662deff5807b to your computer and use it in GitHub Desktop.
Save CodeMaster7000/c32bd587233d36f9dd1d662deff5807b to your computer and use it in GitHub Desktop.
A simple file generator coded in C++.
#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