有没有耐玩的网游网络游戏危害少年的例子??长久耐玩的传奇版本?高分求解

高分求解 - 网络游戏公司面试题(Java)
100mmzhping]
编辑:www.fx114.net
本篇文章主要介绍了"高分求解 - 网络游戏公司面试题(Java)
100mmzhping]",主要涉及到高分求解 - 网络游戏公司面试题(Java)
100mmzhping]方面的内容,对于高分求解 - 网络游戏公司面试题(Java)
100mmzhping]感兴趣的同学可以参考一下。
行数统计器程序需求
~~~~~~~~~~~~~~~~~~
程序目的:
&&&&给定多个源程序文件,统计每个源程序的物理行数、逻辑行数(非注释行)和注释行数;以及所有文件上述三种统计值的总计值。
&&&&注意:如果一行内有超过一处行内注释,则本行可以同时算作逻辑行和注释行。
程序输入:
&&&&1个以上的文件名。
程序输出:
&&&&根据命令行参数不同,可以分别得到下面两种输出:
&&&&1.纯文本输出。
&&&&2.HTML表格输出。
&&&&具体输出的格式由程序员从用户角度考虑,自行设计。
其他要求:
&&&&1.多线程:如果是多个文件,则每一个文件的统计需要同时进行。
&&&&2.易于扩充:程序未来可能需要扩充,比如其他输出格式。
&&&&被统计的源文件是合法(编译器可编译通过)的文件。联系方式:
&&&&Emial:物理行数&Easy&,遍历&换行符
逻辑行数就是&检查&"&;&"&、&"&{&"&&、&"&}&"&&
注释行数&是检查&&"&//&"&&、&"&/*&"&、"&/**&"&&、&"&*/&"
大概这样吧新手学习,友情UP二楼说得对!关注,学习物理行数&Easy&,遍历&换行符
逻辑行数就是&检查&"&;&"&、&"&{&"&&、&"&}&"&&
注释行数&是检查&&"&//&"&&、&"&/*&"&、"&/**&"&&、&"&*/&"
大概这样吧能给出源程序吗?
多线程也是重中之重,对网络游戏来说新手学习经验一个多线程方面的例子,已发至你的邮箱这里有段C++代码,哪位大侠能用Java改写,并用多线程实现???
/*********************************************************
统计c++文件
*********************************************************/
int&CCountingDlg::GetCppFileLines(LPCTSTR&strFileName,&int*&pnLength,&int&*pnCodeLines,&int*&pnCommentLines,&int*&pnBlankLines)
//there&are&two&methods&to&count&lines&in&files,&by&CStdioFile&or&CFile
*pnLength&=&0;
*pnCodeLines&=&0;
*pnCommentLines&=&0;
*pnBlankLines&=&0;
CStdioFile&
if(file.Open(strFileName,&CFile::modeRead)==FALSE)
int&nLines&=&0;
int&nCodeLines&=&0;
int&nCommentLines&=&0;
int&nBlankLines&=&0;
BOOL&bCommentSet&=&FALSE;&//注释行统计标识&有"/*"时TRUE,&"*/"时FALSE
BOOL&bQuatoSet&=&FALSE;&&&//字符串统计标识&首次一行有奇数个"时TRUE,&下一行有奇数个"时FALSE
int&nLength&=&file.GetLength();
*pnLength&=&nL
CString&bufR
int&nLineCommentBegin&=&0;
while(file.ReadString(bufRead)!=FALSE)
BOOL&bStatedComment&=&FALSE;//本行作为注释行是否已统计过
BOOL&bStatedCode&=&FALSE;&&&//本行作为代码行是否已统计过
bufRead.TrimLeft();&//先将文件头的空格或制表符去掉
if(bufRead.GetLength()==0)&//为空白行
nBlankLines++;
if(bCommentSet&&&&bufRead.Find("*/")==-1)
nCommentLines++;
if(bufRead.Find("//")==-1&&&&bufRead.Find("/*")==-1&&&&bufRead.Find("*/")==-1)
{//如果本行根本就无注释符,则要不是注释符,要不是代码行
if(bCommentSet)
nCommentLines++;&
if(bufRead.Find('"')==-1)
nCodeLines++;&
if(bufRead.Find("//")==0&&&&!bCommentSet&&&&!bQuatoSet)
nCommentLines++;
BOOL&bDoubleSplashFound&=&FALSE;
BOOL&bSplashStarFound&=&FALSE;
for(int&i=0;&i&bufRead.GetLength()-1;&i++)
char&cTemp&=&bufRead[i];
if(bufRead[i]=='/'&&&&bufRead[i+1]=='/'&&&&!bCommentSet&&&&!bQuatoSet)
if(!bStatedComment&&&&(m_nStatMethod==1&||&m_nStatMethod&==2))
bStatedComment&=&TRUE;
nCommentLines++;
bDoubleSplashFound&=&TRUE;
i++;//应该+1,但也没有什么用处
else&if(bufRead[i]=='/'&&&&bufRead[i+1]=='*'&&&&!bCommentSet&&&&!bQuatoSet)
if(!bStatedComment&&&&(m_nStatMethod==1&||&m_nStatMethod&==2))
bStatedComment&=&TRUE;
nCommentLines++;
bCommentSet&=&TRUE;
bSplashStarFound&=&TRUE;
//计算代码行必须在bCommentSet关闭之前
else&if(bufRead[i]!='&'&&&&bufRead[i]!='\t'&&&&!bCommentSet)
if(!bStatedCode)
bStatedCode&=&TRUE;
nCodeLines++;
if(bufRead[i]=='\\')
{//\之后的字符要跳过
if(bufRead[i]=='\'')
if(bufRead[i+1]=='\\')
if(bufRead[i]=='"')
{//"必须引起重视,感谢ltzhou
bQuatoSet&=&!bQuatoS
else&if(bufRead[i]=='*'&&&&bufRead[i+1]=='/'&&&&bCommentSet&&&&!bQuatoSet)
if(!bStatedComment&&&&(m_nStatMethod==1&||&m_nStatMethod&==2))
bStatedComment&=&TRUE;
nCommentLines++;
bCommentSet&=&FALSE;
bSplashStarFound&=&TRUE;
if(bDoubleSplashFound)
if(m_nStatMethod==2&&&&bStatedCode)&//如果统计方法为第三种,且同时有代码行与注释行,则只计注释行
nCodeLines--;
if(m_nStatMethod==0&&&&!bStatedCode)//如果统计方法为第一种,且未作为代码行统计过,那么必为注释行
nCommentLines++;
if(bufRead[bufRead.GetLength()-1]=='"'&&!bCommentSet)
{//若某行最后一个是",则必定用来关闭bQuatoSet,记代码行一行,否则报错
bQuatoSet&=&!bQuatoS
if(!bQuatoSet)
if(!bStatedCode)
bStatedCode&=&TRUE;
nCodeLines++;
CStdioFile&fileL
if(fileLog.Open(m_strLogFile,&CFile::modeCreate|CFile::modeWrite|CFile::modeNoTruncate)==TRUE)
CString&strM
if(fileLog.GetLength()==0)
strMsg.Format("文件\t行\t问题\n",&strFileName,&nLines);
fileLog.WriteString(strMsg);
strMsg.Format("%s\t%d\t字符串换行未用\\\n",&strFileName,&nLines);
fileLog.WriteString(strMsg);
fileLog.Close();
if(bufRead[bufRead.GetLength()-1]!='&'&&&&bufRead[bufRead.GetLength()-1]!='\t'&&&&!bCommentSet
&&&bufRead[bufRead.GetLength()-2]!='*'&&&&bufRead[bufRead.GetLength()-1]!='/')
{//如果最后一个字符非空格或制表符,且前面无/*,最后两个字符不是*/,则为代码行
if(!bStatedCode)
bStatedCode&=&TRUE;
nCodeLines++;
if(bSplashStarFound)
if(m_nStatMethod==2&&&&bStatedCode)&//如果统计方法为第三种,且同时有代码行与注释行,则只计注释行
nCodeLines--;
if(m_nStatMethod==0&&&&!bStatedCode&&&&!bStatedComment) //若该行无代码如&&&&/*abc*/&//222
//但是统计方法是第一种,则需要追加注释行计数一次
bStatedComment&=&TRUE;
nCommentLines++;
if(!bStatedComment&&&&bCommentSet)//可能是前面有/*,在第一种统计方法中,未作为代码行计算过,那么本行肯定是注释行
if(m_nStatMethod==0&&&&!bStatedCode)
bStatedComment&=&TRUE;
nCommentLines++;
if(bQuatoSet&&&&bufRead[bufRead.GetLength()-1]=='"')
bQuatoSet&=&FALSE;
if(bQuatoSet&&&&bufRead[bufRead.GetLength()-1]!='\\')
CStdioFile&fileL
if(fileLog.Open(m_strLogFile,&CFile::modeCreate|CFile::modeWrite|CFile::modeNoTruncate)==TRUE)
CString&strM
if(fileLog.GetLength()==0)
strMsg.Format("文件\t行\t问题\n",&strFileName,&nLines);
fileLog.WriteString(strMsg);
strMsg.Format("%s\t%d\t字符串换行未用\\\n",&strFileName,&nLines);
fileLog.WriteString(strMsg);
fileLog.Close();
*pnCodeLines&=&nCodeL
*pnCommentLines&=&nCommentL
*pnBlankLines&=&nBlankL
file.Close();
}ding强给我发一个。lyz_面试还要你写程序吗?从来没有遇到过能给我发一个多线程的程序吗?
up帅哥,给我传一个吧,多谢
upclass&Result{}//存储单一文件的统计结果
interface&Printer{//格式输出类
&&public&void&print(Result&res);//输出数据
&&public&void&close();//释放资源
class&TextPrinter{//输出纯文本文件
&&public&TextPrinter(String&file){}//打开文件file作为输出
&&synchronized&public&void&print(Result&res){}//输出数据,一定要同步处理
&&public&void&close(){}//释放资源
class&HtmlPrinter同TextPrinter(输出Html格式文件)
class&Counter&implements&Runnable{
&&Printer&p;
&&public&Counter(File&f,Printer&p){
&&&&this.f=f;
&&&&this.p=p;
&&public&void&run(){
&&&&//统计数据并生成结果
&&&&Result&res=new&Result();
&&&&//res.set...;
&&&&p.print(res);
public&class&Count{
&&public&static&void&main(String&args[]){
&&&&File&f=new&File(args[0]);//根据参数确定要处理的文件
&&&&File&fl[]=
&&&&if(f.isDirectory()){
&&&&&&fl=f.listFiles();
&&&&&&fl=new&File[1];
&&&&&&fl[0]=f;
&&&&Printer&p=getPrinter(args[1]);//根据参数确定输出格式
&&&&Thread[]&t=new&Thread[fl.length];
&&&&for(int&i=0;i&fl.i++){
&&&&&&t[i]=new&Thread(fl[i],p);//创建线程并启动
&&&&&&t[i].start();
&&&&for(int&i=0;i&fl.i++){
&&&&&&try{
&&&&&&&&t[i].join();//等待线程结束
&&&&&&}catch(Exception&e){}
&&&&p.close();//释放资源
&&private&static&Printer&getPrinter(String&args){}//根据参数确定输出格式
t[i]=new&Thread(fl[i],p);//创建线程并启动
t[i]=new&Thread(new&Counter(fl[i],p));程序这么复杂?看来工作不简单哦!to&flyxxxxx(空指針):
能将完整的编译通过的代码mailto:吗?
3x!不好意思,我在公司用的临时电脑上没jdk,上面是记事本写的。
其实上面的代码也写的差不多了,如果不急的话,晚上回去写给你。如此多谢!我也想要一份,能麻烦也给我mail一份吗?
是邮件接受失败,请重发一遍好吗?我也想要一份,能麻烦也给我mail一份吗?
是&.hk进来学习回复人:&flyxxxxx(空指針)&(&)&信誉:99&&&15:33:00&&得分:0&
&&不好意思,我在公司用的临时电脑上没jdk,上面是记事本写的。
其实上面的代码也写的差不多了,如果不急的话,晚上回去写给你。
厉害,我没编译器的话,写程序会出无数个错误,blush
高手就是高手。
java&1.4&以上就有正则表达式了,我觉得做这个可能会容易一些,现在在家里,到公司写写试试看,^_^
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家社会集体的和公民的合法权益,不得利用本站制作、复制和传播不法有害信息!
二、互相尊重,对自己的言论和行为负责。
本文标题:
本页链接:

我要回帖

更多关于 刀塔传奇团本11章高分 的文章

 

随机推荐