2、函数名: log10
功 能: 对数函数log,以10为底
用 法: double log10(double x)
程序示例:
#include <math.h>
#include <stdio.h>int main(void)
{
double result
double x = 800.6872
result = log10(x)
printf("The common log of %lf is %lf\n", x, result)
return 0
}
3、函数名: log
功 能: 对数函数log,以e(2.71828)为瞎升底
用 法: double log(double x)
程序示例枝伍:
#include <math.h>
#include <stdio.h>int main(void)
{
double result
double x = 800.6872
result = log(x)
printf("The common log of %lf is %lf\n", x, result)
return 0
}
Java的Log是一个非常强大的写日志的工具包,程序员可以随时做和把一些想要记录的信息输出到本地文件,可以用于观察程序运行状况等,代码如下:
import org.apache.log4j.FileAppenderimport org.apache.log4j.Logger
import org.apache.log4j.Level
import org.apache.log4j.SimpleLayout
public class ApacheLog {
public static void main(String args[]) {
纯游盯 Logger logger = Logger.getLogger(ApacheLog.class)
SimpleLayout layout = new SimpleLayout()
FileAppender appender = null
try {
appender = new FileAppender(layout, "myApacheLog.log", false)
磨脊 } catch (Exception e) {
}
logger.addAppender(appender)
// Set the logger level to Level.INFO
logger.setLevel(Level.INFO)
// This request will be disabled since Level.DEBUG < Level.INFO.
logger.debug("This is debug.")
// These requests will be enabled.
logger.info("This is an info.")
logger.warn("This is a warning.")
logger.error("This is an error.")
logger.fatal("This is a fatal error.")
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)