online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <fstream> #include <string> #include <sstream> #include <iomanip> using namespace std; int main() { ifstream file("Programming.txt"); if(file.is_open()) { string line; int wordcount = 0; while(getline(file, line)) { stringstream ss(line); string word; while (getline(ss >> ws, word, ',')) { if (word == "Ball") wordcount++; } } file.close(); cout << "Ball occurred " << wordcount << " times"; } else { cerr << "File is closed!"; } }
Ball, Ball, Cat, Dog, Ball,

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

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

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue