刚开始学,看的一脸懵逼的
#include <io.h>
#include <直接>
#include <stdio.h>
#include <stdlib.h>
#include <字符串>
#define 最大 256
长总计;
int countlines (const char *filename);
void findAllCodes (const char *path);
void findALLFiles (const char *path);
int countLines (const char *filename)
{
文件 *fp;
整数计数 = 0;
int temp;
if( (fp = fopen (filename,"r") )== NULL
{
fprintf(stderr, "无法打开文件: %s\n",文件名) ;
返回 0;
}
while((temp = fgetc (fp) )! = EOF)
{
if(temp == '\n' )
{
计数++;
}
}
fclose(fp) ;
返回计数;
}
void findAllCodes (const char *path)
{
结构_finddata_t法;
长柄;
char thePath,target;
strcpy (thePath,path) ;
if (handle = _findfirst (strcat (thePath, "/*.c") , &fa) )! = -1L
{
做
{
sprintf (target,"%s/%s",path,fa.name) ;
总计 += 计数线 (目标) ;
}while (_findnext (handle,&fa) == 0) ;
}
_findclose (手柄) ;
}
void findALLDirs (const char *path)
{
结构_finddata_t法;
长柄;
char thePath;
strcpy (thePath,path) ;
if ( (handle = _findfirst (strcat (thepath,"/*") ,%fa) ) == -1L)
{
fprintf (stderr,"The path %s is error! \n", path) ;
返回;
}
做
{
if(! strcmp (fa.name,".")|| ! strcmp (fa.name, "..") )
继续;
if ( fa.attrib == _A_SUBDIR)
{
sprintf (thePath,"%s/%s",path,fa.name) ;
findAllCodes (thePath) ;
findALLDirs (thePath) ;
}
}while(_findnext (handle,&fa)== 0) ;
_findclose (手柄) ;
}
int main ()
{
char path = ".";
printf ("计算中...\n") ;
findAllCodes (path) ;
findALLDirs (path) ;
printf ("目前你总共写了 %1d 行代码! \n\n",total);
系统 ("暂停") ;
返回 0;
}
up牛牛牛
1
1
dd
let me sese
1
对对答案
haoye
102
0 因为计算机只能事业0和1
1 机器语言 汇编语言
2 编译
3
4 可以
5
6 对表
为啥windows代码编译后是0行,把代码复制过去结果也是0行,不解{:10_243:}
6666666666666666666666666666666
看看答案
课程还蛮有趣
1
只能识别0、1代码;机器语言;编译;可以;在另一平台上装个解释器
6666666666666666666666
,