ruoju's profileRuoju's PRESENTPhotosBlogListsMore ![]() | Help |
Ruoju's PRESENTLive, as though it was your last day; love, as though you had never loved. |
|||||||||||||||||
|
May 12 回忆昨天,展望明天晕,已经12点过了啊
就当现在是周一深夜吧
昨天和老乡mm去可口可乐
为我在Atlanta的生活画上圆满的句号:)
只可惜相机照了十张相片就没电了。。。。
不过从仅有的几张pp中就能看出他的风格
色彩绚烂+历史悠久+时尚现代
宣扬happiness和share
最有意思的是品尝5大洲的可口可乐产品
发现自己超喜欢欧洲版的peach tea,还有非洲的几种口味:)
反而不喜欢亚洲和美洲的了
喝完一圈后再喝classic和diet已经变味了!
还有很多好玩的
大白熊和我拍照时把我脸捂住,超可耐
看4D电影寻找secret recipe
回顾各个时期各个地域的coke commercial
每人都可以得到生产线展示室里刚下线的瓶装coke
赶紧进入展望明天,困了。。。
明天的任务就是在relocation工作人员的帮助下租好apartment
在Plantation正式落户:)
May 01 mentor的蛋糕刚才收到mentor送的蛋糕
上面写着“Good job Ruoju”
好惊喜啊!
明天是我在Motorola实习的ending date
明天晚上参加Georgia Tech毕业典礼
从明晚开始,我将是Georgia Tech Alumna
从5月18日起,我将是Motorola Full-time Employee
热烈庆祝! bless perl [zz]
程序包括5个文件: person.pm :实现了person类 dog.pm :实现了dog类 bless.pl : 正确的使用bless bless.wrong.pl : 错误的使用bless bless.cc : 使用C++语言实现了与bless.pl相同功能的代码 person.pm
CODE:
#!/usr/bin/perl -w package person; use strict; sub sleep() { my ($self) = @_; my $name = $self->{"name"}; print("$name is person, he is sleeping\n"); } sub study() { my ($self) = @_; my $name = $self->{"name"}; print("$name is person, he is studying\n"); } return 1; dog.pm
CODE:
#!/usr/bin/perl -w package dog; use strict; sub sleep() { my ($self) = @_; my $name = $self->{"name"}; print("$name is dog, he is sleeping\n"); } sub bark() { my ($self) = @_; my $name = $self->{"name"}; print("$name is dog, he is barking\n"); } return 1; bless.pl
CODE:
#!/usr/bin/perl =w use strict; use person; use dog; sub main() { my $object = {"name" => "tom"}; # 先把"tom"变为人 bless($object, "person"); $object->sleep(); $object->study(); # 再把"tom"变为狗 bless($object, "dog"); $object->sleep(); $object->bark(); # 最后,再把"tom"变回人 bless($object, "person"); $object->sleep(); $object->study(); } &main(); # 程序运行时输出: # tom is person, he is sleeping # tom is person, he is studying # tom is dog, he is sleeping # tom is dog, he is barking # tom is person, he is sleeping # tom is person, he is studying bless.wrong.pl
CODE:
#!/usr/bin/perl =w use strict; use person; use dog; sub main() { my $object = {"name" => "tom"}; # 没有把类型信息和$object绑定,因此无法获知$object有sleep方法 $object->sleep(); $object->study(); } &main(); # 程序运行输出为: # Can't call method "sleep" on unblessed reference at bless.wrong.pl line 10. 使用c++实现bless的功能 c中的代码
CODE:
#include <stdio.h> #include <stdlib.h> #include <string.h> struct object { char name[16]; }; struct person { char name[16]; void sleep() { printf("%s is person, he is sleeping\n", this->name); } void study() { printf("%s is person, he is studying\n", this->name); } }; struct dog { char name[16]; void sleep() { printf("%s is dog, he is sleeping\n", this->name); } void bark() { printf("%s is dog, he is barking\n", this->name); } }; #define bless(object, type) ((type*) object) int main() { struct object * o = (struct object *) malloc(sizeof(struct object)); strcpy(o->name, "tom"); // 先把"tom"变为人 bless(o, person)->sleep(); bless(o, person)->study(); // 再把"tom"变为狗 bless(o, dog)->sleep(); bless(o, dog)->bark(); // 最后,再把"tom"变回人 bless(o, person)->sleep(); bless(o, person)->study(); return 0; } // 程序运行时输出: // tom is person, he is sleeping // tom is person, he is studying // tom is dog, he is sleeping // tom is dog, he is barking // tom is person, he is sleeping // tom is person, he is studying 关键的地方就是把对象o的类型转变为person类型和dog类型 April 29 考得也太差了吧!!! faint!
刚考完一门final
感觉是本小姐学生生涯以来考得最差的一次
该好好面壁思过
都怪自己完全不care,昨晚才开始复习。。。。
讽刺的是本小姐即将结束学生生涯
幸亏明天那门final才是真正的final中的final
啥都不说了
赶紧复习
那门还是相对有谱些的
之前quiz2,3都得了满分
sigh,不能这样想啊。。。
quiz4就是因为极度自大不复习
搞了个刚过平均分。。。
啥都不说了
赶紧复习 April 22 ANSI 和 UNICODE 的函数对应表【转】ANSI UNICODE 通用 char wchar_t TCHAR
printf wprintf _tprintf atoi _wtoi _ttoi atof _wtof _tstof strlen wcslen _tcslen 补充: 宽字符 和 字符 转换 第一个就是宽字符到多字节字符转换函数,函数原型如下: 此函数把宽字符串转换成指定的新的字符串,如ANSI,UTF8等,新字符串不必是多字节字符集。参数: lpWideCharStr: 待转换的宽字符串。 wchar_t* pwszUnicode = "Holle, word! 你好,中国! "; iSize = WideCharToMultiByte(CP_ACP, 0, pwszUnicode, -1, NULL, 0, NULL, NULL); 第二个是多字节字符到宽字符转换函数,函数原型如下: 此函数把多字节字符串转换成宽字符串(Unicode),待转换的字符串并不一定是多字节的。 |
感谢访问!
|
|||||||||||||||
|
|