想知道
1
0 只能读取0和1
1 机器语言
2 编译
3 编译出的机器语言可直接被CPU执行,而解释型语言需要通过解释器解释后才能被CPU执行
4 能,C语言可移植性高
5 解释型语言将源代码转化为中间码,再通过解释器翻译给CPU执行,故具有跨平台性
6 编码和解码
7 亲们趁敌人吃饭时发起进攻
查看答案
1
查看参考答案
{:5_102:}
来了来了,做好题立马来看答案了
查看参考答案
查看参考答案
1
1
d
daan
查看参考答案
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#define MAX 256
long total;
int countlines(const char *filename);
int isCode(const char *filename);
void findAllDirs(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;
}
int isCode(const char *filename)
{
int length;
length = strlen(filename);
if (!strcmp(filename + (length - 2), ".c"))
{
return 0;
}
else
{
return 0;
}
}
void findAllDirs(const char *path)
{
DIR *dp;
struct dirent *entry;
struct stat statbuf;
if ((dp = opendir(path)) == NULL)
{
fprintf(stderr, "The path %s is wrong!\n", path);
return;
}
chdir(path);
while ((entry = readdir(dp)) !=NULL)
{
(entry->d_name, &statbuf);
if (!strcmp(".", entry->d_name) || !strcmp("..", entry->d_name))
continue;
if (S_ISDIR(statbuf.st_mode))
{
findAllDirs(entry->d_name);
}
else
{
if (isCode(entry->d_name))
{
total += countLines(entry->d_name);
}
}
}
chdir("..");
closedir(dp);
}
int main()
{
char path = ".";
printf("计算中...\n");
findAllDirs(path);
printf("目前你总该写了 %ld 行代码!\n\n",total);
return 0;
}
好难啊
修改
打完代码人都没了{:10_266:}
修改