The Way To Great

通往伟大的路

用户操作
[即时聊天] [发私信] [加为好友]
AlbertID: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
怎么没连接,请楼主修复下,谢谢!!!
空军一号:太好了!
爱死你了,哈哈
文章分类
收藏
相册
RIA的朋友们
不会飞的鱼
更新很快,关注业内的RIA朋友Y-Boy(RSS)
存档
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes

原创 【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的用法测试

评论:没有评论。

发表评论  


登录
Csdn Blog version 3.1a
Copyright © Albert