fork download
  1. unsigned int IPAddressToNumber(std::string IPaddress)
  2. {
  3. std::string arrDec[] = {"","","",""};
  4. unsigned int intResult = 0, i = 0, j = 0;
  5. for(i = 0; i < IPaddress.length(); i++)
  6. {
  7. if(IPaddress[i] == '.')
  8. j++;i++;
  9. arrDec[j] += IPaddress[i];
  10. }
  11. for (i = 0; i < 4; ++i)
  12. intResult += (unsigned int)(atoi(arrDec[i].c_str()) % 256) * pow((double)256, (int)i);
  13. return intResult;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:32: error: 'string' is not a member of 'std'
 unsigned int IPAddressToNumber(std::string IPaddress)
                                ^
prog.cpp:2:1: error: expected ',' or ';' before '{' token
 {
 ^
stdout
Standard output is empty