The Way To Great
通往伟大的路
登录
注册
全站
当前博客
空间
博客
好友
相册
留言
用户操作
[即时聊天]
[发私信]
[加为好友]
Albert
ID:zinking3
共
59024
次访问,排名
1796
好友
15
人,关注者
21
人
where there is a will,there is a way to great.
zinking3的文章
原创 191 篇
翻译 6 篇
转载 14 篇
评论 27 篇
Albert的公告
最近评论
yiyi:
这个功能我知道
但是,这玩艺怎么去掉?我有个地方控制buttonbar里的内容根据鼠标缩放,缩到一半文字给截了,它就给我弹个tooltip出来- -
buttonbar又没有itemRenderer这样的属性,就算有,也不可能放label,要知道button怎么去掉这个功能也好办啊
奇怪的jane:
so, reference is changed to have different value, but if you assume now each listener received different value , its not correct, they will both received latest assigned value . overall inline fun……
sap99:
www.sap99.com/,SAP99资料多多
SAP免费资料下载
http://www.sap99.com
有很多的学习资料,推荐一下,
ocean:
Loading Collada Files into Papervision3D
Testing Kinematics with Papervision3D Collada
DCC Tutorials
怎么没连接,请楼主修复下,谢谢!!!
空军一号:
太好了!
爱死你了,哈哈
文章分类
.NET
(RSS)
JAVA
(RSS)
LINUX
(RSS)
MATH
(RSS)
RIA
(RSS)
SHELL SCRIPT
(RSS)
人工免疫
(RSS)
生活感悟
(RSS)
数字艺术
(RSS)
收藏
FLASH LITE
相册
RIA的朋友们
不会飞的鱼
更新很快,关注业内的RIA朋友Y-Boy
(RSS)
存档
2008年07月(1)
2008年05月(1)
2008年04月(25)
2008年03月(31)
2008年02月(10)
2008年01月(18)
2007年12月(62)
2007年11月(13)
2007年10月(21)
2007年09月(9)
2007年08月(4)
2007年07月(8)
2007年06月(8)
订阅我的博客
【C&C++】上海交大以前的一道复试题
收藏
新一篇: 【C&C++】stringstream的一些用法 - 尝试一下新的东西
|
旧一篇: 【C&C++】sscanf的用法测试
/**/
/*
上海交通大学cs的一道复试题
原题目如下:
给你一串路径,譬如
ac
ade
bcst
d
你把这些路径中蕴涵的目录结构给画出来,子目录直接列在父目录下面,并比父目录向右
缩一格,就象这样
a
b
c
d
e
b
cst
d
程序通过调试没有问题
只不过员题目有一点要求排序,我这里使用了指针来存储在VECTOR里,使用SORT的时候就出现问题了,
有解决意见的可以在后面评论
作者:Albert
*/
#include
<
iostream
>
#include
<
vector
>
#include
<
algorithm
>
#include
<
string
>
#include
<
sstream
>
#include
<
fstream
>
using
namespace
std;
class
Directory
...
{
public
:
bool
hasSubDirectoy(
string
dname)
...
{
int
n
=
subdirs.size();
if
( n
==
0
)
return
false
;
for
(
int
i
=
0
;i
<
n;i
++
)
...
{
if
( subdirs[i]
->
DirectoryName
==
dname)
return
true
;
}
return
false
;
}
Directory
*
getSubDirectory(
string
dname )
...
{
int
n
=
subdirs.size();
if
( n
==
0
)
return
NULL;
for
(
int
i
=
0
;i
<
n;i
++
)
...
{
if
( subdirs[i]
->
DirectoryName
==
dname)
return
subdirs[i];
}
return
NULL;
}
Directory
*
addSubPath(
string
dname )
...
{
Directory
*
pDir
=
new
Directory();
pDir
->
DirectoryName
=
dname;
subdirs.push_back( pDir );
//
sort( subdirs.begin(),subdirs.end(),comp);
//
POINTER VECTOR NOT EASILY SORTED
return
pDir;
}
int
removeAllPaths()
...
{
int
n
=
subdirs.size();
if
( n
!=
0
)
...
{
for
(
int
i
=
0
;i
<
n;i
++
) subdirs[i]
->
removeAllPaths();
}
delete
this
;
return
1
;
}
~
Directory()
...
{
removeAllPaths();
}
void
OutPut()
...
{
static
int
level
=
0
;
cout
<<
DirectoryName
<<
endl;
int
n
=
subdirs.size();
if
( n
!=
0
)
...
{
int
thislevel
=
level
++
;
for
(
int
i
=
0
;i
<
n;i
++
)
...
{
for
(
int
j
=
0
;j
<
level;j
++
) cout
<<
"
"
;
subdirs[i]
->
OutPut();
}
level
=
thislevel;
}
return
;
}
string
DirectoryName;
vector
<
Directory
*
>
subdirs;
protected
:
private
:
}
;
void
ParseString(Directory
*
pDir,
string
des)
...
{
int
n
=
des.size();
int
from
=
0
;
int
to
=
0
;
string
substr;
stringstream ss(des);
while
( getline(ss,substr,
'
\
'
) )
...
{
if
(
!
( pDir
->
hasSubDirectoy( substr) ) )
...
{
pDir
=
pDir
->
addSubPath( substr);
}
else
...
{
pDir
=
pDir
->
getSubDirectory( substr);
}
}
return
;
}
int
main()
...
{
ifstream infile(
"
infile.txt
"
);
string
str;
Directory root;
while
( getline( infile ,str ) )
...
{
ParseString(
&
root,str);
}
root.OutPut();
infile.close();
system(
"
pause
"
);
return
0
;
}
发表于 @
2008年03月23日 12:35:00
|
评论(
loading...
)
|
编辑
新一篇: 【C&C++】stringstream的一些用法 - 尝试一下新的东西
|
旧一篇: 【C&C++】sscanf的用法测试
评论:没有评论。
发表评论
姓 名:
主 页:
校验码:
看不清,换一张
登录