online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <fstream> #include <iostream> static void ReadFile() { std::ifstream file("myfile.txt"); std::string line; if (!file.is_open()) return; while (std::getline(file, line)) std::cout << line << std::endl; file.close(); } static void WriteFile() { std::ofstream file("myfile.txt", std::ios_base::app); if (!file.is_open()) return; file << "Another line added" << std::endl; file.close(); } int main() { ReadFile(); WriteFile(); return 0; }
Hello world! This is a test. Another line added

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text



Program is not being debugged. Click "Debug" button to start program in debug mode.