online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <fstream> #include <sstream> #include <string> int main() { std::string line; //in case of using array, size must be fixed and predetermined int arr[4] = {0}; //all elements are initialzed to zero. Also you can choose array size according to your needs int i = 0;//this variable will be used to add element into the array int count = 0; 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 { arr[count] = i; ++count; if(count>=4) { break; } } } //print out the elements of the array for(int i: arr) { 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