完成啦
以为写出来是个啥呢
没想到是个行数检测器哈哈哈
AndicLessemis 发表于 2024-7-25 13:37
完成啦
以为写出来是个啥呢
没想到是个行数检测器哈哈哈
为什么显示是0行。。。
11111
#include <io.h>
#include <direct.h>
#inculde <stdio.h>
#inculde <stdlib.h>
#inculde <string.h>
#define Max 256
long total;
int countLines(const char *filename);
void findAllCodes(const char *path);
void findAllFiles(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 files: %s\n", filename);
return 0;
}
while ((temp = fgetc(fp)) != EOF)
{
if(temp == '\n')
{
count++;
}
}
fclose(fp);
return count;
}
void findALLDirs(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, "/*"), &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);
system("pause");
return 0;
}
0
a
11
0只能看懂计算码
1计算码
2编译
3?
4可以
5?
6特定密码组合与字符一一对应
7…
1
1
5
答案答案
okok~
0:傻。只认识1和0
1:机器语言
2.编译
3.一个整体。一个是一行一行
4.不行!
6
编译
{:5_90:}
请问为什么使用VS无法运行?{:10_266:}
计算机只会读懂自己的语言,根据指令运行
{:10_277:}
^_^
1