1
来看答案咯
666
a
只认识0, 1
机器
编译
是否可直接执行
能
?
映射关系
?
11
char path = ".";
printf("计算中...\n");
findAllCodes(path);
findALLDirs(path);
printf("目前你总共写了 %ld 行代码!\n\n", total);
system("pause");
return 0;
顶顶顶
1
1
..
1.机器语言
6666
111
求
答案
有两处怎么检查都是错误的,是一样的检查了好多遍一摸一样为甚恶魔运行不了呢
0.因为计算机只能处理0和1
1.C
2.编译
3.是否要翻译成机器语言
4.不一定
5.借助同一个程序来来理解你的语言
6.通过0和1还有 的不同排列顺序来表达不同的字母,数字,及符号
朕很开心
#include <io.h>
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 256
long total;
int countLines(const char *fliename);
void findAllCodes(const char *path);
void findAllFilles(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,"/*"),&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;
}