首页 > TAG信息列表 > zhuy

java单件模式

原文链接:http://www.cnblogs.com/zhuy/archive/2012/05/12/2497038.html 在系统中,往往有一些服务只需要它们在整个系统中只存在一个实例,而且可以在系统的任意角落访问到它,我们引入单件模式来解决这个问题,这是众多设计模式中的一种 class testSingleton

c++中控制输出精度的几种方式

原文链接:http://www.cnblogs.com/zhuy/archive/2012/07/27/2611178.html //控制输出精度;可以用iostream中的precision或是用iomanip中的setrecision; #include<iostream> #include<iomanip> using namespace std; int main() { float a=4.5891589;

快速幂取模的运算

原文链接:http://www.cnblogs.com/zhuy/archive/2012/07/26/2609588.html 1 //快速幂取模, 2 #include <iostream> 3 4 using namespace std; 5 //1. 6 //a^n%b 7 int modExp(int a, int n, int b) 8 { 9 int t,y; 10 t=1;y=a; 11