| CODE |
| #include <iostream> #include <cstdlib> #include <fstream> #include <string> using namespace std; ofstream source("source.cpp", ios::app); string StrSource="#include <iostream>\nusing namespace std;\nint main()\n{\n"; int conout(); int alldone(); int main() { int choice; cout << "What do you want to do?\n"; cout << "\t1.Send text to the screen\n"; cout << "\t2.Save and finish\n"; cin >> choice; switch (choice) { case 1: system("cls"); return conout(); break; case 2: system("cls"); return alldone(); break; default: cout << "eh, that's not a choice\n"; system("pause"); system("cls"); return main(); break; } return 0; } int conout() { string message; cout << "What text should be sent to the screen(when you're done, press tab then enter)?\n"; getline(cin, message,'\t'); StrSource.append ("cout << \""); StrSource.append (message); StrSource.append ("\" << endl;\n"); StrSource.erase (63,1); cout << "message saved\n"; cout << StrSource; system("pause"); system("cls"); return main(); } int alldone() { cout << "Saving your new source code to source.cpp...\n"; StrSource.append ("system(\"pause\");\nreturn 0;\n}"); source << StrSource; cout << "Your new source code has been saved, have fun with it ^ _^\n"; system("pause"); return 0; } |
| QUOTE (Rmstn1580 @ Dec 9 2005, 02:25 AM) |
| You have a smiley in your code... Why still using system("PAUSE"); use cin.get(); it looks a lot better |