测试下CodeBox
想想以后应该用得着这个插件,毕竟有些时候还是会在博客里贴上代码的。这是插件的主页:http://wordpress.org/extend/plugins/wp-codebox/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include <stdio.h> double ComputePI() { int segment = 16 * 256; double length = 1.0; double segment_width = length / segment; double sum = 0.0; int step = 0; double pos = 0.0; for (step = 0; step < segment; step++) { pos = (step + 0.5) * segment_width; sum += 4 / (1 + pos * pos); } sum *= segment_width; return sum; } int main(int argc, char *argv[]) { double pi = ComputePI(); printf("PI is %fn", pi); return 0; } |
近期评论