online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <unistd.h> // getopt #include <vector> #include <string> #include <list> #include <sstream> using namespace std; typedef struct pairwise_param { double alpha; double beta; } param; void param_getopt(param *pm, int argc, char **argv){ int opt; while((opt=getopt(argc,argv,"a:b:"))!=-1){ switch(opt){ case 'a': pm->alpha = atof(optarg); break; case 'b': pm->beta = atof(optarg); break; } } } int maincomp(int argc, char* argv[]){ //initialize param structure param pm; //pass command line arguments to param param_getopt(&pm, argc, argv); std::cout << "Alpha: " << pm.alpha << std::endl; std::cout << "Beta: " << pm.beta << std::endl; return(0); } int main(int argc, char* argv[]){ //create string and pass it to maincomp std::string cmd = "-a2.3 -b3.2"; std::istringstream ss(cmd); std::string arg; std::list<std::string> ls; std::vector<char*> newargv; while (ss >> arg) { ls.push_back(arg); newargv.push_back(const_cast<char*>(ls.back().c_str())); } newargv.push_back(0); int out = maincomp(newargv.size(), &newargv[0]); return(out); }

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