this little program above will write 4 lines of text to a file named "recipe.txt"Code:#include <fstream> #include <iostream> using namespace std; int main() { char recnam[50]; char text[120]; cout<< "Enter Recipe name \n"; cin.getline(recnam, 50, '\n'); ofstream reci( "recipe.txt" ); reci<< recnam<< '\n \n'; cin.getline(text, 120, '\n'); reci<< text<< '\n'; cin.getline(text, 120, '\n'); reci<< text<< '\n'; cin.getline(text, 120, '\n'); reci<< text<< '\n'; cin.getline(text, 120, '\n'); reci<< text<< '\n'; reci.close(); }
isn't there a better way to do this? (please say yes lol)
I'm using a "recipe" as an example, but I want to be able to write, basically.. a text editor lol...
I'm just starting so I grabbed bloodshed Dev-C++ IDE.
Anyway.. can anyone help me?