凑凑 发表于 2021-7-19 15:18:17

0.因为计算机只能人说一步做一步,不会转弯
1.计算机语言
2.编译
3.编译型是全部转换成二进制,再运行;解释型是翻一句,执行一句
4.不能,不同系统不一样
5.

Blackgalaxy 发表于 2021-7-19 15:52:17

计算中...
目前你总共写了 0 行代码!

Blackgalaxy 发表于 2021-7-19 16:07:40

你好,我用的Macos,打出来怎么是“计算中...目前你总共写了 0 行代码!”,我查了代码没有问题,复制粘贴也是显示0行

kongyunfei 发表于 2021-7-19 16:46:42

1

千秋若离 发表于 2021-7-19 17:10:00

蹲蹲答案

明灬哲 发表于 2021-7-19 17:14:14

1

fengyuyxz 发表于 2021-7-19 17:15:05

讲解的挺好的,问题已经自己答完,对比下看自己是否有记忆错误的地方

郝龌龊 发表于 2021-7-19 17:43:29

回复

焦糖橙子 发表于 2021-7-19 18:00:22

是不是Visual Studio2019调用不了里面的函数?运行的时候一直报错说函数不安全。

q928153424 发表于 2021-7-19 18:50:14

终于好啦,QAQ

cc12580 发表于 2021-7-19 19:00:24

看看

dene. 发表于 2021-7-19 20:05:59

alv1n 发表于 2021-7-19 20:22:13

1

Min腻 发表于 2021-7-19 20:25:07

做完啦

2579913024 发表于 2021-7-19 21:04:21

1
1

划不莱 发表于 2021-7-19 21:42:10

要学好编程,得很熟悉键盘

guyihui 发表于 2021-7-19 21:43:23

终于抄完了!

Cmling 发表于 2021-7-19 21:56:06


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

3022142224 发表于 2021-7-19 22:27:40

666666666666666666666

satisfaction 发表于 2021-7-19 22:36:56

0
计算机只认识二进制的机器码

1
机器语言

2
编译

3
编译型先转换成二进制文件再执行
解释型需要由解释器逐行执行

4
不可以

5
..

6
以点线的组合表示字母

7
..


页: 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 [1265] 1266 1267 1268 1269 1270 1271 1272 1273 1274
查看完整版本: S1E2:第一个程序 | 课后测试题及答案