fork download
  1. #include <iostream>
  2. #include <netinet/in.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. auto i = ntohs(1);
  8. cout << i << endl;
  9.  
  10. i = ntohs(2);
  11. cout << i << endl;
  12.  
  13.  
  14.  
  15. i = ntohl(0x10203040);
  16. cout << hex << i << endl;
  17. i = ntohl(i);
  18. cout << hex << i << endl;
  19.  
  20. i = ntohl(0x8d000000);
  21. cout << i << endl;
  22.  
  23. i = ntohl(0x67000000);
  24. cout << i << endl;
  25.  
  26. i = ntohl(0x41000007);
  27. cout << i << endl;
  28.  
  29. i = ntohl(0x0000005f);
  30. cout << i << endl;
  31.  
  32. return 0;
  33. }
  34.  
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
256
512
2010
0
8d
67
41
0