diff options
feat(Week06): Add solutions
1 files changed, 16 insertions, 0 deletions
| -rw-r--r-- | Week06/Exercise01.cpp | 16 |
diff --git a/Week06/Exercise01.cpp b/Week06/Exercise01.cpp new file mode 100644 index 0000000..ff6153f --- /dev/null +++ b/Week06/Exercise01.cpp @@ -0,0 +1,16 @@ +#include <iostream> +#include <fstream> + +int main() { + std::ofstream outFile("HelloWorld.txt", std::ios::trunc); + + if (!outFile.is_open()) { + std::cout << "Couldn't open file!" << std::endl; + } + else { + const char HELLO_WORLD[] = "Hello World!"; + outFile.write(HELLO_WORLD, sizeof(HELLO_WORLD) / sizeof(*HELLO_WORLD)); + } + + return 0; +} |
