天天开心!! 发表于 2021-10-13 16:30:10

看答案

iinni 发表于 2021-10-13 16:31:08

daan

LIZEPENG 发表于 2021-10-13 16:31:41

{:5_90:}

1molHF 发表于 2021-10-13 16:34:25

不知道

guodax11 发表于 2021-10-13 16:43:41

给我看看

成果. 发表于 2021-10-13 19:23:17

1

林万奇 发表于 2021-10-13 19:28:27

他只能识别0和1

肥宅最后的倔强 发表于 2021-10-13 19:38:09


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

qwxiaohuli 发表于 2021-10-13 20:01:34

123

我们就是花海 发表于 2021-10-13 20:26:01

0.因为计算机的CPU只懂得二进制的0和1;
1.机器语言;2.编译;
3.编译型语言可将源代码直接编译成机器码,从而被CPU直接识别;解释型语言是将源代码转化成中间代码,再通过解释器翻译,从而被CPU识别。
4.能。
5.通过解释器翻译中间代码而实现跨平台;
6.将原文进行编码(查表);7.QINMENCHENDIRENCHIFANSHIFADONGJINGONG。

肉肉饭团 发表于 2021-10-13 20:49:37

0:只认识0和1
1:机器语言
2:编译
3:编译过程不同
4:可以
5:字节码到解释器的过程可以跨平台操作
6:编码和翻译
7:。。。。。

1436793975 发表于 2021-10-13 21:33:51

本帖最后由 1436793975 于 2021-10-13 21:40 编辑

maomaola 发表于 2021-10-13 22:37:50

952行

MiaomiaoKing 发表于 2021-10-14 00:23:24

{:5_102:}

lovebz225 发表于 2021-10-14 00:58:56

看看对比一下结果

今天能学习吗 发表于 2021-10-14 10:17:39

DAAN

lgec 发表于 2021-10-14 10:21:07

1

Usnow 发表于 2021-10-14 10:40:46

访问

Maricsol 发表于 2021-10-14 10:50:00

.

白雲 发表于 2021-10-14 11:37:43

学习学习{:5_109:}
页: 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 [1417] 1418 1419 1420 1421 1422 1423 1424 1425 1426
查看完整版本: S1E2:第一个程序 | 课后测试题及答案