ITeye博客

learn and do

haoshuang3394 · 共 146 篇文章

Stroking or Filling a Shape:画图或填充图形

// Stroke the shape. g2d.draw(shape); // Fill the shape. g2d.fill(shape);

2009-06-21 00:26 · java学习 · 评论(0)

标准数组--向量(3)

下面的代码显示了怎样把各种各样的泛型算法应用到vector 类对象上 #include <vector> #include <algorithm> #include <iostream> int ia[ 10 ] = { 51, 23, 7, 88, 41, 98, 12, 103, 37, 6 }; int main() { vector< int > vec( ia, ia+10 ); // 排序数组 sort( vec.begin(), vec.end() ); // 获取值 int search_value; cin >> search_value; // 搜索元素 vector<i…

2009-06-21 00:15 · C++学习 · 评论(0) · C · 算法 · C++ · C#

randrange1.py源代码分析

import random #导入随机数包 def rollDice(): die1 = random.randrange( 1, 7 ) %随机获取1到7之间的一个数 die2 = random.randrange( 1, 7 ) %随机获取1到7之间的一个数 workSum = die1 + die2 %求和 print "Player rolled %d + %d = %d" % ( die1, die2, workSum ) return workSum %返回随机和 sum = rollDice() # first dice roll %第一次“滚动” if sum == 7 or…

2009-06-21 00:08 · python学习 · 评论(0)

seekbuy_info.php源代码分析

<link href="css/style.css" rel="stylesheet"> <?php include("conn/conn.php"); %导入数据库连接文件 ?> <table width="563" height="587" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="563" height="587" valign="top" bgcolor="#FFFFFF"><table width="563" border="0" cellspacing="0" cellpadding="0"> <tr>…

2009-06-20 23:55 · php学习 · 评论(0) · CSS · PHP · SQL · MySQL

Creating a Shape from a Stroked Shape

float strokeThickness = 5.0f; BasicStroke stroke = new BasicStroke(strokeThickness); Shape newShape = stroke.createStrokedShape(shape);

2009-06-19 01:09 · java学习 · 评论(0)

标准数组--向量(2)

另外一种遍历方法是使用迭代器对iterator pair 来标记向量的起始处和结束处。迭代 器是一个支持指针类型抽象的类对象。vector 类模板提供了一对操作begin()和end(), 它们分 别返回指向向量开始处和结束处后1 个的迭代器,这一对迭代器合起来可以标记出 待遍历元素的范围。例如。下面的代码是前面代码段的一个等价实现 #include < vector > extern int getSize(); void mumble() { int size = getSize(); vector< int > vec( size ); vector< int >::iterator …

2009-06-19 00:31 · C++学习 · 评论(0) · 算法

randrange.py源代码分析

import random #导入随机数工具包 def rollDice(): die1 = random.randrange( 1, 7 ) #取1到7之间的任意一个数 die2 = random.randrange( 1, 7 ) #取1到7之间的任意一个数 workSum = die1 + die2 #求两个随机数的和 print "Player rolled %d + %d = %d" % ( die1, die2, workSum ) #打印和式 return workSum #返回随机数的和 sum = rollDice() # first dice roll if sum ==…

2009-06-19 00:17 · python学习 · 评论(0)

seek_buy.php源代码分析

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <link href="css/style.css" rel="stylesheet"> <title>九九供求信息网</title> <style type="text/css"> <!-- body { background-image: url(Images/bg.gif); } --> </style> </head> <body> <table width="780" border="0" align="center"…

2009-06-19 00:04 · php学习 · 评论(0) · HTML · CSS · PHP

Changing the Thickness of the Stroking Pen:改变画笔的厚度

dashPhase is the offset to start the dashing pattern. float strokeThickness = 5.0f; // A solid stroke BasicStroke stroke = new BasicStroke(strokeThickness); g2d.setStroke(stroke); drawShape(g2d); // A dashed stroke float miterLimit = 10f; float[] dashPattern = {10f}; float dashPhase = 5f; stroke = …

2009-06-17 23:58 · java学习 · 评论(0)

标准数组——向量(1)

正如我们已经看到的,尽管C++内置的数组支持容器的机制,但是它不支持容器抽象的 语义,为了在这样的层次上编写程序,在标准C++之前我们要么从某个途径获得这样的类, 要么自己实现这样的类。在标准C++中,数组类是C++标准库的一部分,现在它不叫数组 而叫向量vector 了。 当然向量是一个类模板,所以我们这样写 vector<int> ivec( 10 ); vector<string> svec( 10 ); 上面的代码分别定义了一个包含10 个整型对象的向量和一个包含10 个字符串对象的向量。 在我们实现的Array 类模板与vector 类模板的实现之间,有两个主要区别,第一个区别是 …

2009-06-17 23:48 · C++学习 · 评论(0) · C · 算法 · C++ · C#

maximum.py分析

def maximumValue( x, y, z ): maximum = x if y > maximum: maximum = y if z > maximum: maximum = z return maximum #先定义一个函数,此函数用来求三个参数中的,最大的一个,并返回最大值 a = int( raw_input( "Enter first integer: " ) ) b = int( raw_input( "Enter second integer: " ) ) c = int( raw_input( "Enter third integer: " ) ) #获取三个整数…

2009-06-17 23:47 · python学习 · 评论(0) · C · C++ · C# · F# · Python

search_info.php源代码分析

<link href="css/style.css" rel="stylesheet"> <?php include("conn/conn.php"); %数据库连接文件 ?> <table width="563" height="587" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="563" height="587" valign="top" bgcolor="#FFFFFF"><table width="563" border="0" cellspacing="0" cellpadding="0"> <tr> <…

2009-06-17 23:31 · php学习 · 评论(0) · CSS · PHP · SQL · MySQL

用其他名字来命名数组(3)

<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no…

2009-06-16 16:29 · C++学习 · 评论(0) · C · C++ · C#

breakFor.py分析

for x in range( 1, 11 ): #用x来遍历1到11这11个数字 if x == 5: break #若x等于5,则跳出for print x, #若不为5,则打印x print "\nBroke out of loop at x =", x #打印x的跳出值

2009-06-16 15:44 · python学习 · 评论(0)

sale_info.php源代码分析

<link href="css/style.css" rel="stylesheet"> <?php include("conn/conn.php"); %包含数据库连接文件 ?> <table width="563" height="587" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="563" height="587" valign="top" bgcolor="#FFFFFF"><table width="563" border="0" cellspacing="0" cellpadding="0"> <tr>…

2009-06-16 15:36 · php学习 · 评论(0) · CSS · PHP · SQL · MySQL