查看参考答案
加油
{:10_250:}
1
1
本帖最后由 黎明§末日 于 2024-3-25 17:21 编辑
课后作业:
测试题:
0:cpu它只能读的懂2进制的0和1
1:机器语言
2:编译
3:编译型语言编译出来的机器语言是可执行文件,可以直接被cpu执行
解释型语言不直接编译成机器码,而是将源代码转化为中间代码,发送给解释器由解释器逐句翻译给cpu执行
4:不能
5:解释器可以把源码编译成不同平台的代码,从而实现跨平台
6:是查表
7:qin men chen di ren chi fan shi fa dong
亲们 趁敌人吃饭时发动
动动手:
#include <io.h>
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
#include <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 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;
}
学习学习
完成
查看参考答案
加油!
.
学习!
{:5_104:}
111
抄完了,执行不了一点,把原代码复制过去和自己敲的错误数一样,不知道咋解决
我来啦
0:难道说因为是二进制的原因?
1:汇编语言
2:编译
3:一个是全部编写完再编译,一个是可以随时添加?
4:可以
5:因为他是转换成字节码,再有解释器翻译
6:二进制,0和1组成的代码
7:qfnmen chend irenc hifan shif adong jingo ng(猜不出来{:10_266:})
6
想看答案
啊,为什么我抄完但结果是0行(Linux)