280404930 发表于 2022-8-11 10:34:02

.

Lrfso666 发表于 2022-8-11 13:42:43

da an

FancyFan- 发表于 2022-8-11 14:50:37

{:5_105:}

ginogu 发表于 2022-8-11 14:53:52

102

1834963143 发表于 2022-8-11 15:09:05

加油

Asuuuuna 发表于 2022-8-11 15:10:20

求答案啊!

影子离开我 发表于 2022-8-11 15:16:44

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

YRB 发表于 2022-8-11 15:20:32

XY

ddhh123321 发表于 2022-8-11 16:32:33

1

雾霖雾霖啊 发表于 2022-8-11 16:47:10

1.机器语言
2.编译
3.
6.查表
4 可以

susqi 发表于 2022-8-11 17:23:18

~

晴日初落 发表于 2022-8-11 18:38:41

三至十五个字符 发表于 2022-8-11 19:33:22

二进制

叫我健健子 发表于 2022-8-11 19:41:19

查看参考答案

COSIM 发表于 2022-8-11 20:48:55

gh

不想娶名字 发表于 2022-8-11 21:13:20

#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <字符串>
#include <stdlib.h>
#include <sys/stat.h>

#define 最大 256

长总计;

int countLines(const char *filename);
int isCode(const char *filename);
void findAllDirs(const char *path);

int countLines(const char *filename)
{
文件 *fp;
整型计数 = 0;
int temp;

if ((fp = fopen(filename, “r”)) == NULL)
      {
fprintf(stderr, “无法打开文件: %s\n”, 文件名);
返回 0;
      }

while ((temp = fgetc(fp)) != EOF)
      {
if (temp == '\n')
                {
计数++;
                }
      }

fclose(fp);

返回计数;
}

int isCode(const char *filename)
{
整型长度;

length = strlen(filename);
      
if (!strcmp(filename + (length - 2), “.c”))
      {
返回 1;
      }

      {
返回 0;
      }
}

void findAllDirs(const char *path)
{
DIR *dp;
struct dirent *entry;
struct statbuf;

if ((dp = opendir(path)) == NULL)
      {
fprintf(stderr, “path %s is error!\n”, path);
返回;
      }

chdir(path);
while ((entry = readdir(dp)) != NULL)
      {
lstat(entry->d_name, &statbuf);

if (!strcmp(“.”, entry->d_name) || !strcmp(“..”, entry->d_name))
继续;

如果 (S_ISDIR(statbuf.st_mode))
                {
findAllDirs(entry->d_name);
                }

                {
if (isCode(entry->d_name))
                        {
总计 += 计数线(入门级>d_name);
                        }
                }
      }

chdir(“..”);
closedir(dp);
}

int main()
{
字符路径 = “.”;

printf(“计算中...\n”);

findAllDirs(path);

printf(“目前你总共写了 %ld 行代码!\n\n”, total);

返回 0;
}

wzt23 发表于 2022-8-11 21:21:50

d

若善水 发表于 2022-8-11 21:30:34

0、只认识机器码
1、机器语言
2、编译
3、C为一次性编译为可执行代码,解释为一句一句翻译为中间代码,再解释为机器代码
4、不可以
5、通过解释器
6、用符号来替代字母

长腿静香 发表于 2022-8-11 21:40:42

102

完整的名字 发表于 2022-8-11 21:54:15

&#128076;
页: 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 [1704] 1705 1706 1707 1708 1709 1710 1711 1712 1713
查看完整版本: S1E2:第一个程序 | 课后测试题及答案