1. 道歉(我会补偿你的 I'll make it up to you)

原文链接:http://talk.oralpractice.com/article_12715.html

- I'm really sorry, Bob. I accidentally damaged your bike. 

- Uh-oh. It'll probably cost a lot to fix it.

- I'll make it up to you. Let me know how much it costs and I'll give you the money.

我真的很抱歉,鲍勃。我不小心将你的自行车弄坏了。

糟糕,修起来可能要花很多钱。

我会补偿你的。花了多少钱告诉我,我会给你钱。

展开阅读全文

=======Pchar!!!!!!!!!!!I 服了 YOU============

07-21

今天改写一个DLL里面的string成pchar,痛苦啊!!!!!!!rn于是开始研究,测试代码如下:rnrn测试环境:D6rn操作系统:WIN 2000 SP4rnrn//传递pchar参数,然后返回pchar参数!!!rnfunction TForm1.test(const str: PChar): Pchar;rnvarrn s:string;rnbeginrn s:=str;rn result:=Pchar(s+#0);rn //result:=Pchar(s);rnend;rnrn//测试功能1rnprocedure TForm1.Button2Click(Sender: TObject);rnvarrn ss:string;rnbeginrn ss:='11100';rn E_Enc.Text:=test(Pchar(ss));//rn E_Dec.Text:=test(Pchar(ss));//rnend;rnrnrnprocedure TForm1.Button3Click(Sender: TObject);rnvarrn sd:Pchar;rn ss:string;rnbeginrn ss:='22200';rn sd:=test(Pchar(ss));rn //ss:=sd;rn E_Enc.Text:=sd;//rn E_Dec.text:=sd;//rnend;rnrn测试1:rn先点击Button2,编辑框E_Enc和E_Dec都是11100。这个结果正确。rn然后点击Button3,怪事就来了。E_Enc显示22200--正确,E_Dec显示1110--错误。rn再点击Button3,依然奇怪,E_Enc显示22200--正确,E_Dec显示2220--错误rnrn===================rn测试2:rnpchar应该是一个指针,以0结尾,会不会把最后的0当成结束符号去掉了啊!我继续测试rn把BUTTON2里面的SS修改为'111000',BUTTON3的SS修改为'222000'。rnrn先点击Button2,编辑框E_Enc和E_Dec都是111000。这个结果正确。rn然后点击Button3,怪事就来了。E_Enc显示222000--正确,E_Dec显示111000--错误。rn再点击Button3,依然奇怪,E_Enc显示222000--正确,E_Dec显示222000--正确rnrn我要抓狂了。难道奇数个字符就会错误,偶数个就不会?rn还是PCHAR我没有管理好内存???于是我决定在一个函数的入口和出口的时候,rn使用PCHAR,在内部处理使用STRING。rnrn继续测试rn=================================rnrn测试3:rn修改BUTTON3函数如下rnprocedure TForm1.Button3Click(Sender: TObject);rnvarrn sd:Pchar;rn ss:string;rnbeginrn ss:='22200';rn sd:=test(Pchar(ss));rn ss:=sd;rn E_Enc.Text:=ss;//rn E_Dec.text:=ss;//rnend;rnrn这下E_Enc和E_Dec都显示正确了。rnrn分析测试2和测试3的不同。在于使用PCHAR和STRING上。但既然SD是PCHAR类型,应该是指针,为什么赋值rn两个edit后,会有不一样呢?原因一直分析不出来。rnrn================================rn求救:哪位大哥可以帮我分析PCHAR和string在使用上的不同和注意点,包括rn把string类型的字符串转换为pchar作为参数传递进函数内部,并作为参数传递出来,rn再转换为string有什么要注意的地方。rnrn 论坛

How I Wonder What You Are!

01-22

DescriptionnnOne of the questions children often ask is “How many stars are there in the sky?” Under ideal conditions, even with the naked eye, nearly eight thousands are observable in the northern hemisphere. With a decent telescope, you may find many more, but as the sight field will be limited, you may find much less at a time.nnChildren may ask the same questions to their parents on a planet of some solar system billions of light-years away from the Earth. Their telescope are similar to ours with circular sight fields, but alien kids have many eyes and ca look into different directions at a time through may telescopes.nnGiven a set of positions of stars, a set of telescopes and the directions the are looking to, your task is to count up how many stars can be seen through these telescopes.nnInputnnThe input consists of one or more datasets. The number of datasets is less than 50. Each dataset describes stars and the parameters of the telescopes used.nnThe first line of a dataset contains a positive integer n not exceeding 500, meaning the number of stars. Each of the n lines following it contains three decimal fractions, sx, sy, and sz. They give the position (sx, sy, sz) of the star described in Euclidean coordinates. You may assume −1000 ≤ sx ≤ 1000, −1000 ≤ sy ≤ 1000, −1000 ≤ sz ≤ 1000, and (sx, sy, sz) ≠ (0, 0, 0).nnThen comes a line containing a positive integer m not exceeding 50, meaning the number of telescopes. Each of the following m lines contains four decimal fractions, tx, ty, tz and ψ, describing a telescope.nnThe first three numbers represent the direction of the telescope. All the telescopes are at the origin of the coordinate system (0, 0, 0) (we ignore the size of the planet). The three numbers give the point (tx, ty, tz) which can be see in the center of the sight through the telescope. You may assume −1000 ≤ tx ≤ 1000, −1000 ≤ ty ≤ 1000, −1000 ≤ tz ≤ 1000, and (tx, ty, tz) ≠ (0, 0, 0).nnThe fourth number ψ (0 ≤ ψ ≤ π ⁄ 2) gives the angular radius, radians, of the sight field of the telescope. Let us define that θi,j is the angle between the direction of the i-th star and the center direction of the j-th telescope and ψj is the angular radius of the sight field of the j-th telescope. the i-th star is observable through the j-th telescope if and only if θi,j is less than ψj. You may assume that |θi,j − ψj| > 0.00000001 for all pairs of i and j.nnnFigure 1: Direction and angular radius of a telescopennThe end of the input is indicated with a line containing a single zero.nnOutputnnFor each dataset, one line containing an integer meaning the number of stars observable through the telescope should be output. No other characters should be contained in the output. Note that stars that can be seen through more than one telescope should not be counted twice or more.nnSample Inputnn3 n100 0 500 n-500.243 -200.1 -300.5 n0 300 200 n2 n1 1 1 0.65 n-1 0 0 1.57 n3 n1 0 0 n0 1 0 n0 0 1 n4 n1 -1 -1 0.9553 n-1 1 -1 0.9554n-1 -1 1 0.9553n-1 1 -1 0.9554n3 n1 0 0 n0 1 0 n0 0 1 n4 n1 -1 -1 0.9553n-1 1 -1 0.9553n-1 -1 1 0.9553n-1 1 -1 0.9553n0nSample Outputnn2n1n0 问答

没有更多推荐了,返回首页