zhymax 发表于 2021-8-5 15:44:03

1

Jayden. 发表于 2021-8-5 16:17:32

daan

wknb 发表于 2021-8-5 16:30:55


jhjh

卢本萎 发表于 2021-8-5 16:41:32

甲鱼哥 我这个怎么弄啊
百度上也找了但是看不懂....求助求助{:5_92:}
https://pic.eehhtt.org/images/202108/71a1da2660df2de0.png
https://pic.eehhtt.org/images/202108/c8ebbe20d9fccb67.png
https://pic.eehhtt.org/images/202108/880f19a45ea79697.png

2191683381 发表于 2021-8-5 17:17:27

参考答案

行者隐侠 发表于 2021-8-5 17:17:41

我写完啦

2495796779 发表于 2021-8-5 18:04:14

累死鸟

lyh666666 发表于 2021-8-5 18:59:11

11

C小白MY--猫猫 发表于 2021-8-5 19:18:03

自己敲了一遍然后复制粘贴了一遍,都发生错误了为什么QAQ。。。

不会语言的学生 发表于 2021-8-5 19:44:20

11

动听c语言 发表于 2021-8-5 20:05:25

目前你总共写了 8388608 行代码!
咋回事。。。

225813 发表于 2021-8-5 20:36:49

0.计算机只能识别二进制语言
1.机器语言
2.编译
3.编译型语言可以由汇编语言翻译成机械语言与CPU直接执行,而解释型语言需要用到解释器
4.不可以
5.由源代码转化成中间代码发送给解释器再由CPU执行
6.编译
7.亲们趁敌人吃饭时发起进攻

lospollo 发表于 2021-8-5 20:59:59

1:计算机只能识别二进制代码
2:机器语言
3:是否编译成机器码
4:能
5:通过解释器来在不同平台解释同样的代码

98486896 发表于 2021-8-5 21:17:08

..

k。王 发表于 2021-8-5 21:18:40

怎么还有问题,搞半天弄不好,原来是你设置的

空恐箜 发表于 2021-8-5 21:20:56

参考答案

CHESS工作室 发表于 2021-8-5 21:27:59

为什么复制的中文都是"???????"

zf2402435 发表于 2021-8-5 21:51:24

1

62986197 发表于 2021-8-5 21:54:31

查看答案

惘蝤蛴 发表于 2021-8-6 00:24:14


#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("目前你总共写了 %1d 行代码! \n\n",total);
        system("pause");
       
        return 0;
}
页: 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 [1298] 1299 1300 1301 1302 1303 1304 1305 1306 1307
查看完整版本: S1E2:第一个程序 | 课后测试题及答案