#include <iostream>
#include <math.h>
using namespace std;
class ip{
private:
    string ip;
    int result[8];
    int sum;
public: 
   void input(){
    /* cout<<"Enter First 8 Binary in Ip address: ";
     cin>>ip;
     for(int i=0,j=7;i<8 ,j>=0;++i,--j){
        if(ip[i]=='1'){
            result[i]=pow(2,j);
        }else if(ip[i]=='0'){
            result[i]=0;
        }
    }
     for(int i=1 ; i<8 ; ++i){
     sum=sum+result[i];
   } */
   cout<<sum<<"\n";
 }
};
int main() {
ip convert;
convert.input();
return 0;
}
I was getting some problem while running this code then I understood the problem is with integer initialization...
please help me as I'm getting unwanted output
after running this code my output is: 131 I expected '0' as output why is it so
 
     
    