xianyu~pan 发表于 2020-1-15 15:13:55

i

qkdgz 发表于 2020-1-15 15:55:04

S1E2:第一个程序 | 课后测试题及答案 [修改]

囧灬囧 发表于 2020-1-15 16:59:43

LOVE FISHC

不会秃头 发表于 2020-1-15 17:19:33

F:\

Marbloro 发表于 2020-1-15 17:19:40

0:我们几个的算计只能够识别,计算机语言如二进制的01.八进制,十六进制等。
1:CPU唯一认识的就是我们的机器语言。
2:
3:编译型语言不需要借助解释器
4:能,应为都是用C语言的符号来进行编写的。
5:在认识平台上只要有解释型编程语言的解释器就能够进行转化,
6:讲我们能够识别的信息通过一定的规律转化成我们不能识别的信息
7.qinmenchendirenchifanshifadongjingong

18603726828 发表于 2020-1-15 17:25:11

大一了,来晚了,不过我要努力学

zlatan 发表于 2020-1-15 19:24:05

kankan

1952330645 发表于 2020-1-15 19:36:59

回复看答案

wssss 发表于 2020-1-15 20:08:33

1st

chenancheng 发表于 2020-1-15 20:12:39

6666666666666666666666666

teresay 发表于 2020-1-15 20:22:21

我做完啦!

二三san 发表于 2020-1-15 21:36:40

{:5_90:}

不会C啊 发表于 2020-1-15 22:15:39

0.计算机只有二进制0和1
1.机器语言
2.

北冥坤 发表于 2020-1-15 22:17:01

查看参考答案

大风起兮90+ 发表于 2020-1-15 22:30:42

查看答案

lqh123 发表于 2020-1-15 22:37:45

?

Jinx- 发表于 2020-1-15 23:35:13

0 CPU是计算机的大脑,CPU只能读懂二进制的0和1.
1 CPU能将0和1的组合跟具体的指令挂钩,这些0和1的组合成为机器码,也叫机器语言,属于第一代编程语言,也是CPU唯一可以读懂的语言
2 编译器将C语言编写的源代码转换为汇编语言的过程叫编译
3 编译型语言最终编译成机器语言,也就是可执行文件,从此CPU就可以直接执行;解释型语言不直接编译成机器语言,而是将源代码转换成中间代码,然后发送给解释器,由解释器逐句翻译给CPU执行。
4 C语言可移植性高,不需要改动或者稍加修改就可以在其他机器上编译后正确执行。
5 解释型语言时将源代码转换成字节码,然后发送给解释器,编译器逐句翻译给CPU执行,每执行一次翻译一次,以实现跨平台功能。
6 摩斯密码的原理是查表,将明文对着编码表翻译为点横组合的过程称为编码,将点横组合解密回原文的过程称为解码。
7 呆了,老外看不懂,我好像也没看懂

Jinx- 发表于 2020-1-16 00:25:04

呜呜呜我觉得我是照抄的了,但是运行出来结果还是不一样,求帮忙看看。
下面是代码

运行结果是写了10行代码{:5_107:}

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

deng_o3o 发表于 2020-1-16 10:34:22

1111

1049676597 发表于 2020-1-16 10:59:59

1
页: 507 508 509 510 511 512 513 514 515 516 [517] 518 519 520 521 522 523 524 525 526
查看完整版本: S1E2:第一个程序 | 课后测试题及答案