online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> using namespace std; int main() { string str; getline(cin, str); int count = 0; for (int i = 0; i < str.length(); i++) { if (str.at(i) == ' ') { i++; } else { while (str.at(i) != ' ') { i++; if (str.at(i) == str.length()) { break; } } count++; } } cout << "number of words are : " << count; }

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