1
十个小时没搞明白
查看参考答案
只认二进制的0和1
机器语言
编译
前者整体编译,效率高 后者分步解释,效率相对低
80%可
字节码交给解释器解释给cpu执行
符号替代文字
亲们,趁敌人吃饭时发动进攻
{:10_254:}
鱼C有你更精彩^_^
#include<io.h>
#include<direct.h>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#define MAX 256
long total;
int countLines(const char *filename);
void fineAllCodes(const char *path);
void fineAllFiles(const char *path);
int countLines(const char *filename)
{
FILE*fp;
int count=0;
int temp;
if ((fp=fopen(filename,"r"))==NULL)
{
fprintf(stderr,"Can not open the file: %s\n",filename);
return 0;
}
while((temp=fgetc(fp))!=EOF)
{
if(temp=='\n')
{
count ++;
}
}
fclose(fp);
return count;
}
void findAllCodes(const char *path)
{
struct _finddata_t fa;
long handle;
char thePath,target;
strcpy(thePath,path);
if((handle=_findfirst(strcat(thePath,"/*.c"),&fa))!=-1L)
{
do
{
sprintf(target,"%s%s",path,fa.name);
total +=countLines(target);
}while (_findnext(handle,&fa)==0);
}
_findclose(handle);
}
void findAllDirs(const char *path)
{
struct _finddata_t fa;
long handle;
char thePath;
strcpy(thePath,path);
if((handle=_findfirst(strcat(thePath,"/*.c"),&fa))!=-1L)
{
fprintf(stderr,"The path %s is wrong!\n",path);
return;
}
do
{
if (!strcmp(fa.name, ".") || !strcmp(fa.name, ".."))
continue;
if(fa.attrib==_A_SUBDIR)
{
sprintf(thePath,"%s%s",path,fa.name);
findAllCodes(thePath);
findAllDirs(thePath);
}
}while(_findnext(handle,&fa)==0);
_findclose(handle);
}
int main()
{
char path=".";
printf(" 计算中...\n");
findAllCodes(path);
findAllDirs(path);
printf("目前你总写了%ld行代码!\n\n",total);
return 0;
}
运行出来是0
6666666666666
1
爱你爱你鱼鱼
1
.
102行
COOL!
{:5_102:}
11111
。
sedfsd
1
你好