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 <vector> #include <map> #include <iomanip> #include <cmath> // using std::cout; // using std::endl; using vi=std::vector<int>; using mii=std::map<int,int>; int lastprime(vi & primes); void primefactorization(int num, mii & m); int main() { mii m {}; int num=15593760; primefactorization(num, m); // for(const auto &x:m) std::cout << x.first<< " wystepuje "<<x.second<<" razy"<<std::endl; // std::cout<< std::endl; //integral//rational int integral=1; int root = 3; for(auto &x:m) { int times = x.second/root; if(times) { integral*=pow(x.first,times); x.second%=root; } } std::cout << " \n\nR = "<< integral<< " "; // for(const auto &x:m) if(x.second) std::cout<< " * v"<<root<<"/ " << pow(x.first,x.second)<<x.second<<"| "; for(const auto &x:m) if(x.second) std::cout<< "* (" << pow(x.first,x.second)<<")^(1/"<<root<<") "; std::cout<< std::endl; return 0; } int lastprime(vi & primes){ // bool isprimre=true; auto it=primes.begin(); auto end=primes.end(); int i=primes.back()+1; for (;it!=end;i++) for(it=primes.begin();it!=end;it++){ if(i%(*it)==0) { break;} }i--; primes.push_back(i); return i; } void primefactorization(int num, mii & m){ //factorise vi v{2}; while (num!=1 ){ int currentnum=v.back(); while (num%currentnum==0){ m[currentnum]++; std::cout<<std::setw(15) <<num<< " | "<<currentnum<<std::endl; num/=currentnum; } lastprime(v); } std::cout<<std::setw(15) <<1<< " | "<<std::endl; // while (lastprime(v)<10); // for(const auto &x:v) std::cout << x<<' '; // std::cout<< std::endl; }

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