摘要: 一、此法要求函数连续,在给定区间内仅有一个根,通过循环十几次即可获得精度要求较高的根(0.00001),精度可自己设定理论依据为函数连续性,在根附近有:f(start) * f(end) < 0#include <stdio.h>#include <stdlib.h>#include <math.h>#define E 2.718float f(float);int main(){ float start, end, mid, precision; int i, count; //三个初值,每次都要赋值 start = 0; //区间左起点 end . 阅读全文
posted @ 2011-11-08 16:35 xiangzi888 阅读(516) 评论(0) 推荐(0) 编辑
摘要: 一、利用系统调用,从标准输入读取字符串,然后输出,类似c里面的 scanf() printf()#include <stdio.h>#include <fcntl.h>#include <unistd.h>#define BUFFSISE 4096int main(void){ int n; char buf[BUFFSISE]; while((n = read(STDIN_FILENO, buf, BUFFSISE)) > 0) write(STDOUT_FILENO, buf, n); exit(0);}二、利用c语言函数,当然,c里面有很多字符处 阅读全文
posted @ 2011-11-08 16:23 xiangzi888 阅读(332) 评论(0) 推荐(0) 编辑