yidakousun 发表于 2022-6-21 12:06:30

答案

皮卡卡阿啾 发表于 2022-6-21 12:17:16

966080

RainLei 发表于 2022-6-21 14:00:07

lailelaile

jh666 发表于 2022-6-21 16:27:51

目前你总共写了102行代码!

yjx20060525 发表于 2022-6-21 17:39:59

查看参考答案

xxxtt 发表于 2022-6-21 17:56:25

{:7_112:}

玛莲妮亚的椅子 发表于 2022-6-21 18:42:36

看看答案{:10_281:}{:10_281:}{:10_281:}

lanouka 发表于 2022-6-21 19:22:19

0.因为计算机只认识0和1
1.机器语言
2.编译
3.一个需要翻译,一个不需要翻译
4.不能
5.不懂
6.查表
7

2437521435 发表于 2022-6-21 19:52:14

冲冲冲

daya1 发表于 2022-6-21 20:04:23

k

lslhj 发表于 2022-6-21 20:54:47

{:5_109:}

Rain风 发表于 2022-6-21 21:04:29

qqq

明天。 发表于 2022-6-21 21:13:46

666

诹访uu 发表于 2022-6-21 21:23:14


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

#define MAX256

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)
{
        stuct _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)
{
        stuct _finddata_t fa;
        long handle;
        char thePath;
       
        strcpy(thePath, path);
        if((handle = _findfirst(strcat(thePath, "/*"), &fa)) == -1L)
        {
                fprintf(stderr, "The path %s is worng!\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;
}

woolok 发表于 2022-6-22 10:09:07

{:5_109:}

小鼬子 发表于 2022-6-22 10:24:31

0.计算只能识别0和1
1.机器语言
2.编译
3.编译直接转化为机器码,解释型是从源代码转化为中间代码
4.不能
5.通过不同平台的解释器进行跨平台
6.查表
7.亲们趁敌人吃饭时发动进攻
(查了半天,还是不太理解编译型和解释型{:10_285:}{:10_285:})

十万伏特biu 发表于 2022-6-22 14:57:00

终于打完了 结果报错{:5_99:}

岩岫杳冥 发表于 2022-6-22 16:18:20

测试题答案

Fan9a0 发表于 2022-6-22 16:25:01

我做到是做了,一个个敲击的指令,不知道怎么就出现了这种情况,现在这个文件更改我都不知道,敲击这个累计写入代码量的程序,是在视频结尾的程序里面测试吗?

Fan9a0 发表于 2022-6-22 16:27:43

我应该是抄错了,但是怎么修改我抄的指令呢,我重新在抄一遍?
页: 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 [1652] 1653 1654 1655 1656 1657 1658 1659 1660 1661
查看完整版本: S1E2:第一个程序 | 课后测试题及答案