炒河粉专卖 发表于 2022-1-18 20:48:41

看一下答案

诚哥哥 发表于 2022-1-18 20:48:41

查看

未若柳絮因风起 发表于 2022-1-18 21:19:06

powered by

沐风i 发表于 2022-1-18 21:43:05

1

缘决 发表于 2022-1-18 21:48:18

可以运行

世界树派蒙 发表于 2022-1-18 22:14:45

{:5_103:}

mdr1998 发表于 2022-1-18 22:43:25

1

比格艾斯 发表于 2022-1-19 02:21:49

计算机cpu之认识二进制,只会读取0和1
汇编语言(机械语言)
编译
执行和编译是分开的
可以执行
解释型编程语言和平台联系很少,只要通过不同的解释器解释就可以执行
摩斯密码是用特殊的符号代替特殊的字母(特殊的意思)

Ljyoung 发表于 2022-1-19 02:47:22


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

Single-Wing 发表于 2022-1-19 02:49:10

我举得你的课程现在很无聊

抱明月而长终 发表于 2022-1-19 09:16:04

111

ZR0627 发表于 2022-1-19 09:26:55

{:5_102:}

francesfx 发表于 2022-1-19 09:58:41

16

#满楼红袖招# 发表于 2022-1-19 10:07:21

1

Jcleo 发表于 2022-1-19 10:17:55

图片没破译出有规律的内容喔

风渐渐 发表于 2022-1-19 10:18:40

答案

咦一哈呦呦 发表于 2022-1-19 10:57:17

查看参考答案

abcdp 发表于 2022-1-19 10:59:12

{:7_136:}

helloworldlsb 发表于 2022-1-19 11:17:26

f

468900940 发表于 2022-1-19 11:41:41

谢谢谢
页: 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 [1530] 1531 1532 1533 1534 1535 1536 1537 1538 1539
查看完整版本: S1E2:第一个程序 | 课后测试题及答案