aboutsummaryrefslogtreecommitdiff
path: root/week06/Exercise03.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'week06/Exercise03.cpp')
-rw-r--r--week06/Exercise03.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/week06/Exercise03.cpp b/week06/Exercise03.cpp
new file mode 100644
index 0000000..f4f0229
--- /dev/null
+++ b/week06/Exercise03.cpp
@@ -0,0 +1,16 @@
+#include <fstream>
+#include <iostream>
+
+int main() {
+ char fileName[1024];
+ std::cin.getline(fileName, 1024);
+
+ std::ofstream file(fileName);
+ if (!file.is_open()) {
+ std::cout << "Couldn't open file!" << std::endl;
+ return 1;
+ }
+
+ file << "Hello World!";
+ file.close();
+}