Convert IP into hostname
How do I convert a numeric IP address like 199.1.32.90 into a hostname like star.blackstar.com? Unfortunately due to an unintended side effect (i.e. a bug) in Java's caching of IP addresses and hostnames, Java 1.0 can't convert numeric IP addresses into hostnames. However this is straightforward in Java 1.1. For example, (Java FAQ:found on the web at:http://sunsite.unc.edu/javafaq/javafaq.html)
AI
AI 摘要: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
源代码
String hostname = InetAddress.getByName("199.1.32.90").getHostName()
#include <iostream.h>
#include <conio.h>
double ctof(double x);
double ftoc(double x);
void ftocf();
void ender();
void ctoff();
int op;
void main ()
{
op=0;
cout<<"Select an Option:"<<endl;
cout<<" 1 for F to C"<<endl;
cout<<" 2 for C to F"<<endl;
cout<<" 3 To End"<<endl;
cin>>op;
if(op==1) ftocf();
if(op==2) ctoff();
if(op==3) ender();
}
void ctoff()
{
int x;
cout<<"Enter Degrees Celcius to Make Into Fahrenheit:"<<endl;
cin>>x;
cout<<"Result: "<<ctof(x)<<endl<<endl;
main();
}
void ftocf()
{
int y;
cout<<"Enter Degrees Fahrenheit to Make Into Celcius:"<<endl;
cin>>y;
cout<<"Result: "<<ftoc(y)<<endl<<endl;
main();
}
double ctof(double x)
{
return ((x*1.8)+32);
}
double ftoc(double y)
{
return ((y-32)/1.8);
}
void ender()
{
cout<<"Press Any Key to Exit"<<endl;
getch();
}
Upload
原始评论 (3)
从 Wayback Machine 恢复