Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- int main() {
- ofstream outfile;
- string line;
- cout << "Enter Message: ";
- getline(cin, line);
- outfile.open("Code.cpp", ios::app);
- outfile << "#include <iostream>" << endl;
- outfile << "using namespace std;" << endl << endl;
- outfile << "int main() {" << endl;
- outfile << "\tchar msg[] = {";
- for(int i = 0; line[i]; i++)
- outfile << int(line[i]) << ", ";
- outfile << 0;
- outfile << "};" << endl;
- outfile << "\tcout << msg << endl;" << endl;
- outfile << "\treturn 0;" << endl;
- outfile << "\}" << endl;
- outfile.close();
- cout << "Source File Created Successfully" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement