1059496154 发表于 2021-8-2 22:09:06

自检

superswagy2002 发表于 2021-8-2 22:09:22

亲们趁敌人吃饭时发动进攻

畜生道 发表于 2021-8-2 22:33:50

0100101010011110

XCYY 发表于 2021-8-2 22:42:42

感谢楼主

12J3 发表于 2021-8-2 23:41:14

亲们趁敌人吃饭始发动静ong

刘先生5527 发表于 2021-8-3 02:34:55

计算机只能识别二进制

萝卜里 发表于 2021-8-3 07:24:13

1

echo1lGy 发表于 2021-8-3 08:06:51

查看参考答案

银尾学编程 发表于 2021-8-3 08:28:10

(0)计算机采用二进制。
(1)机器语言0,1。
(2)编译。
(3)编译型有编译的过程,解释型则没有。
(4)可以。
(5)
(6)查表。

胡狐 发表于 2021-8-3 09:02:19


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

qingyuanne 发表于 2021-8-3 09:33:03

1

fcmldjt12138 发表于 2021-8-3 09:51:11

0:只懂二进制的0和1
1:c语言
2:编译
3:编译语言计算机可以直接读懂,而解释型语言需要通过解释器解释
4:是
5:C语言
6:查表
7:亲们,趁敌人吃饭时发动进攻

HHYJ 发表于 2021-8-3 10:05:30

0.0

zhaidong 发表于 2021-8-3 10:24:24

感谢楼主无私奉献!

songhong 发表于 2021-8-3 10:39:58

1

大漠孤烟1109 发表于 2021-8-3 10:44:26

看答案

Amadeus岚 发表于 2021-8-3 10:47:03

1

Yannis1007 发表于 2021-8-3 11:10:35

好难啊

kuriiper 发表于 2021-8-3 11:24:28

第一课,希望自己能坚持下去

Roninor 发表于 2021-8-3 11:54:12

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