213321213 发表于 2021-2-16 11:52:13

此帖仅作者可见

傲娇小橘子 发表于 2021-2-16 12:58:13

0、因为计算机的大脑是CPU,CPU只能识别“0”和“1”也就是机器语言
1、机械语言
2、编译
3、编译型语言是CPU直接执行编译后的机器语言,解释型语言是指将源代码转换成中间代码,发送给解释器,解释器翻译给CPU执行
4、不能
5、源代码转换成中间代码,发送给解释器,解释器翻译给CPU执行
6、机器语言
7、QINMENCHENDIRENCHIFANSHIFADONGJINGONG

DarkdustAZ 发表于 2021-2-16 13:08:37

S1E2:第一个程序

何来雨声 发表于 2021-2-16 13:33:22

#include <io.h>
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX    256

int countLines(const char *filename);
void findALLCodes(const char *path);
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;
       
}

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 (_findnet(handle, &fa) == 0);
        }
       
        _findclose(handle);//<direct.h>
       
}

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;
}

January... 发表于 2021-2-16 14:23:25

测试题答案

iu欧尼 发表于 2021-2-16 15:39:28

daan

Paulwilliams 发表于 2021-2-16 15:55:19

看看

adanvance 发表于 2021-2-16 16:15:39

瑟瑟发抖的W 发表于 2021-2-16 16:21:37

本帖最后由 瑟瑟发抖的W 于 2021-2-16 16:22 编辑

我的是

计算中...
目前你总共写了217行代码!

刚学C 发表于 2021-2-16 17:16:27

查看参考答案

xing_ying 发表于 2021-2-16 17:20:25

测试题:
0.因为计算机只能读懂0和1
1.机器码(机器语言)
2.编译
3.编译型语言可以直接运行,而解释型语言不能直接运行
4.有些可以直接运行,有些需要进行修改才能运行
5.通过生成字节码。再通过解码器进行运行
6.通过发送解码表中对应的符号进行传递信息
7.亲们趁敌人吃饭时发动进攻
动动手:
计算中...
目前你总共写了 101 行代码!
(截图有点问题所以只能打字了)

勿三分钟热度 发表于 2021-2-16 17:22:02

谢谢甲鱼

是理理啦 发表于 2021-2-16 17:41:00

0.
1.机器语言
2.编译
3.解释型语言不直接编译成机器码而将源代码转化成中间代码
4.能
5.
6.查找指令表
7.

thebin 发表于 2021-2-16 18:29:22

有点难

Daniel久违 发表于 2021-2-16 19:44:39

好了

dlrex 发表于 2021-2-16 20:09:25

{:5_102:}

Briskpace 发表于 2021-2-16 20:39:57

答案

哈兰 发表于 2021-2-16 20:48:33

csustlyf666 发表于 2021-2-16 21:35:49

6666

JON_Answer 发表于 2021-2-16 22:31:28

233
页: 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 [1066] 1067 1068 1069 1070 1071 1072 1073 1074 1075
查看完整版本: S1E2:第一个程序 | 课后测试题及答案