labs 9: init

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-12-26 18:06:44 +05:30
parent 4824ab9855
commit 42902fa122
6 changed files with 208 additions and 3 deletions

25
lab9/27.cpp Normal file
View File

@@ -0,0 +1,25 @@
#include <fstream>
#include <iostream>
using namespace std;
const string FILE_PATH = "./27.out";
int main() {
string line;
cout << "Running program till the string \"EOH\" is received via stdin"
<< endl;
ofstream file(FILE_PATH);
file.close();
file.open(FILE_PATH, ios_base::app);
while (getline(cin, line)) {
if (line == "EOH")
break;
file << line << endl;
}
return 0;
}