zh584520 发表于 2021-6-9 17:42:21

{:5_102:}

ddsz 发表于 2021-6-9 18:35:52

谢谢小甲鱼分享

暖人的冰 发表于 2021-6-9 19:04:45

0.0

pveterminator 发表于 2021-6-10 00:11:42

1

坠入银海 发表于 2021-6-10 07:02:41

liudadaxueC 发表于 2021-6-10 09:45:39

1、只认识0、1
2、机器语言

jxp425 发表于 2021-6-10 10:22:38

看看

zjsx12 发表于 2021-6-10 11:27:47

开始学习,感谢

17673842601 发表于 2021-6-10 11:58:28

1

handsometap 发表于 2021-6-10 13:19:35

谢谢楼主哦!

lifhv 发表于 2021-6-10 15:13:36

1

阿宸同学 发表于 2021-6-10 16:05:56

已完成了 来看答案 谢谢小甲鱼!

wodeyx6300 发表于 2021-6-10 17:27:16

这是C 01

2930099109 发表于 2021-6-10 18:03:23

谢谢鱼总

古道月影 发表于 2021-6-10 19:21:41

CPU只懂0和1
cpu 只能读懂机器码
编译
是否直接编译成机器码
可以
解释性语言先翻译成字节码,要经由解释器解释再给CPU读取
查表

老夫法号戒杀 发表于 2021-6-10 23:31:55

111111

斑澜洛 发表于 2021-6-11 00:32:28

6

lin2930 发表于 2021-6-11 01:34:16

回复一下

Jokeribm 发表于 2021-6-11 08:30:28


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

C语言yyds! 发表于 2021-6-11 10:01:24

{:5_109:}
页: 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 [1209] 1210 1211 1212 1213 1214 1215 1216 1217 1218
查看完整版本: S1E2:第一个程序 | 课后测试题及答案