zhang1129 发表于 2022-9-6 22:48:19

1

1935436821 发表于 2022-9-6 23:22:51

66666666666666666666666666

haibo387 发表于 2022-9-6 23:29:11

11

haibo387 发表于 2022-9-7 02:02:17


#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 findA11Codes(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;
        longhandle;
        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);
                       findA11Codes(thePath);
                       findALLDirs(thePath);
               }
       }while (_findnext(handle, &fa) == 0);
       
       _findclose(handle);
}

int main()
{
        char path = ".";
       
        printf("计算中...\n" );
       
        findA11Codes(path);
        findALLDirs(path);
       
        printf("目前你总共写了 %1d 行代码! \n\n", total);
        system("pause");
       
        return 0;
}
搞不懂哪里有问题

DemonH 发表于 2022-9-7 08:41:13

{:7_132:}

tyf0064 发表于 2022-9-7 10:34:45

支持小甲鱼!

gold2c 发表于 2022-9-7 10:43:32

2

取名麻烦死了 发表于 2022-9-7 11:22:51

   答案

东慕水 发表于 2022-9-7 11:26:09

查看参考答案

江子牙 发表于 2022-9-7 11:28:05

0.电脑只懂得二进制的0和1。
1.CPU唯一认识的语言是机器码,是第一代的编程语言。
2.编译。
3.效率高,灵活度高,可移植性高。
4.可以,Linux系统和Windows系统的部分系统就是由C语言编写的,且大部分的C语言编译的代码都是公用的。
5.把解释性语言转化为中间代码(字节码),到不同的平台上运行,用解释器来翻译给CPU运行。
6.对照编译表进行编码和解码。
7.qin men chen di ren chi fan shi fa dong jin gong -亲们,趁敌人吃饭时发动进攻。

小枫gh 发表于 2022-9-7 13:50:06

来了

忆北 发表于 2022-9-7 14:53:39

查看参考答案

听风掠过雨 发表于 2022-9-7 15:28:24

答案

11630 发表于 2022-9-7 15:55:26

第一天打卡

凰煌磺 发表于 2022-9-7 15:59:33

本帖最后由 凰煌磺 于 2022-9-7 16:10 编辑

最终结果:

C:\编程\collect2.exe        ld returned 1 exit status

也不知道哪里错误{:10_285:}

鱼丸丸敲代码 发表于 2022-9-7 16:03:45

0、只能识别高低电平,即0和1。
1、机器码/语言
2、编译
3、编译型语言是C语言通过编译为汇编语言后,是机器能读懂的语言,CPU直接运行;解释型语言可跨平台交流,但每次都需要通过解释器解释后才能被CPU执行,效率有点慢。
4、可以
5、将字符串转换为字节码,字节码再传给解释器进行解释
6、将字母与特定的符号长短进行匹配,通过敲的长短破译字母。
7、大概是:亲们趁敌人吃饭时发动进攻?

lin123. 发表于 2022-9-7 16:07:55

1111

齐静春来 发表于 2022-9-7 16:21:18

计算中…
目前你总共写了 105 行代码!

一刻i 发表于 2022-9-7 16:27:35

17行报错怎么处理

wysc 发表于 2022-9-7 16:34:20

查看参考答案
页: 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 [1732] 1733 1734 1735 1736 1737 1738 1739 1740 1741
查看完整版本: S1E2:第一个程序 | 课后测试题及答案