美味屑老板 发表于 2021-7-31 22:09:53

答案

BOT100 发表于 2021-8-1 00:31:53

从零开始,感谢小甲鱼!

采茝. 发表于 2021-8-1 08:58:41

答案

今天没有日落 发表于 2021-8-1 09:41:25

我来看答案啦

ASTONIC 发表于 2021-8-1 09:44:12

.....

Xnterstellar 发表于 2021-8-1 10:02:20

123

cnmmsb 发表于 2021-8-1 11:00:58

1

过度好好说 发表于 2021-8-1 11:21:10

答案

calm.weixiao 发表于 2021-8-1 11:36:27

查看答案

大橙子12138 发表于 2021-8-1 11:48:33

回复

传奇狗队二哈 发表于 2021-8-1 12:10:16

1

studymakesmehap 发表于 2021-8-1 14:54:47

6666

我是新手11 发表于 2021-8-1 14:55:54

0.他只知道0和1进制
1.机械语言
2.编译
3.一个简单,一个复杂,效率低
4.不行
5.查表

cwlong 发表于 2021-8-1 15:06:25

1

贩卖黄昏· 发表于 2021-8-1 15:25:29

rbl11 发表于 2021-8-1 15:29:23

0.计算机 CPU 只认识 0 和 1
1.机器语言
2.编译
3.对于 CPU 而言,编译型语言是将源代码先通过编译器编译为 CPU 认识的机器码(可执行文件),此后 CPU 随时都可以直接执行编译后的机器码;而解释型语言则不直接编译成机器码,而是将源码转换成中间代码,然后发送给解释器,由解释器逐句翻译给 CPU 来执行
4.不能去,格式不同
5.解释型编程语言为每个操作系统专门定制一个解释器作为中转,因此解释器只需提供一个统一的入口即可
6.转化

ETOHF 发表于 2021-8-1 15:58:09

1

cqy1357273018 发表于 2021-8-1 16:15:04

答案是0吗?

阿良/ 发表于 2021-8-1 16:25:40


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

       
       

川流801 发表于 2021-8-1 17:07:40

看看题吧
页: 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 [1291] 1292 1293 1294 1295 1296 1297 1298 1299 1300
查看完整版本: S1E2:第一个程序 | 课后测试题及答案