#include <cstdlib> #include <iostream> #include <sstream> using namespace std; int main(int argc, char *argv[]) { string power; string mod; int ans; int a; string d; //int p; int b; int i=23; char c[23]; cout<<"Enter any Number to the power of any Number mod any Number in Decimal\nExample:123 ^ 456 mod 78\n"; cin>>a>>power>>i>>mod>>b; d = itoa(i,c,2); std::istringstream stm; int p; stm.str(d); stm >> p; for(int m = 0; m<p.length(); m++) { if (p = 0) { a=a*a; } else if (p = 1) { a=(a*a)*a; } } ans = a % b; cout<<"The answer is" << ans <<endl; system("PAUSE"); return 0; }

this is what i have done but it seems that there an error on the p.length. could someone help me with this? thxs in advance!!