yangyu-c 发表于 2023-6-8 17:20:18

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

嘟嘟可ing 发表于 2023-6-8 18:35:21


#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);
查找所有代码(路径);
findALLDirs(thePath);
                }
}while (_findnext(handle, &fa) == 0);
   
_findclose(手柄);
}

int main()
{
字符路径 = “.”;
      
printf(“计算中...\n”);
      
查找所有代码(路径);
findALLDirs(path);
      
printf(“目前你总共写了 %ld 行代码!\n\n”, total);
系统(“暂停”);
      
返回 0;
}

LOVESTMF9 发表于 2023-6-8 22:39:35

1,只能识别2进制,机器码
2.机器语言
3.编译
4.有没有中介
5.通过解释器
6.编码与译码
7,不知道

呆呆xiao 发表于 2023-6-9 09:51:03

0.只认识0和1
1.汇编语言
2.编译
3.编译性将源代码全部转换成可执行程序,解释性一边转换一边执行
4.可以
5.语言解释器
6.点,横 密码本进行解释
7. QINMEN(qin men chen di ren chi fan shi fa nong jin gong)
CHEND
IRENC
HIFAN
SHIF
ANONG
JINGO
NG

斗爱鱼 发表于 2023-6-9 12:22:04

好好学习天天向上

桃不是逃. 发表于 2023-6-9 13:04:44

0.只能直接读二进制
1.机器语言
2.编译
3.编译型语言是逐步编译到最后的语言,解释型语言每一次输入都需要经过解释器的解释
4.能
5.将源代码转化成中间代码,再由解释器使得CPU能够读懂
6.通过莫斯编码表进行翻译
7.亲们趁敌人吃饭时发动进攻

wangxinran 发表于 2023-6-9 14:46:47

查看参考答案

小白高 发表于 2023-6-9 16:40:41

666

arendellex 发表于 2023-6-10 01:56:56

1111111111111

Crory 发表于 2023-6-10 08:53:57

螿螿

longxingzhu 发表于 2023-6-10 09:12:27

dda

鸽子咕咕叫 发表于 2023-6-10 13:44:02

看看答案

minglingyijin 发表于 2023-6-10 15:18:26

1

疯狂的二哈 发表于 2023-6-10 16:40:20

        鱼C有你更精彩^_^

松岛小饼干 发表于 2023-6-10 17:53:48

11

年愁今夜 发表于 2023-6-10 23:31:09

1

空空狐枫叶 发表于 2023-6-11 15:57:12

鱼C有你更精彩^_^

ut小菜鸟 发表于 2023-6-12 00:30:12

看看答案

0-0-0--00--0 发表于 2023-6-12 10:04:48

加油

TvTvT 发表于 2023-6-12 15:12:25

查看答案
页: 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 [1901] 1902 1903 1904 1905 1906 1907 1908 1909 1910
查看完整版本: S1E2:第一个程序 | 课后测试题及答案