Initial commit

This commit is contained in:
Michael Reber
2019-11-15 12:59:38 +01:00
parent 40a414d210
commit b880c3ccde
6814 changed files with 379441 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
Write text to a file
#include <iostream.h>
#include <fstream.h>
const char *FILENAME = "myfile.txt";
int main()
{
//create output object associated w/ file
ofstream fout(FILENAME);
cout << "Enter your text: ";
char str[100];
cin >> str;
//write the text to the file
fout << "here is your text\n";
fout <<str<<endl;
//close file
fout.close();
ifstream fin(FILENAME);
char ch;
while (fin.get(ch))
cout << ch;
fin.close();
return 0;
}