online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <vector> #include <sstream> #include <string> int main() { std::string line; std::vector<int> vec; int i = 0;//this variable will be used to add element into the array getline(std::cin, line); std::istringstream s(line); //take input(from s to i) and then checks stream's eof flag status while(s >> i || !s.eof()) { //check if either failbit or badbit is set if(s.fail()) { //clear the error state to allow further operations on s s.clear(); std::string temp; s >> temp; continue; } else { vec.push_back(i); } } //print out the elements of the array for(int i: vec) { std::cout<<"elem: "<<i<<std::endl; } return 0; }

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