袁昌昊 发表于 2025-9-23 21:41:43

求答案

牛姐重生 发表于 2025-9-23 23:34:29

测试题答案

DJLOVESJ 发表于 2025-9-24 10:00:52

查看参考答案

君焰君 发表于 2025-9-24 10:28:33

{:5_107:}

lililike 发表于 2025-9-25 12:44:49

已完成

suilv 发表于 2025-9-25 13:59:41

.

hlool 发表于 2025-9-25 14:24:46

6

rsym 发表于 2025-9-25 16:30:25

{:10_277:}

AAAAer 发表于 2025-9-25 19:09:29

0. 只能识别二进制
1. 机器语言
2. 编译
3. 解释型语言还有转化为中间代码的过程,效率低一些
4. 可以
5. 通过中间代码
6. 映射
7.

tiniho 发表于 2025-9-25 20:37:30

加油

sccccwd 发表于 2025-9-26 09:49:24

{:9_218:}

梦中海 发表于 2025-9-26 12:39:24

666

Stznr68123 发表于 2025-9-26 12:56:33

只懂二进制
机器语言
编译
用时
不能
由解释器翻译给CPU
查表
亲们趁敌人吃饭时发动进攻

haibochina 发表于 2025-9-26 16:28:37

求答案

xzw555 发表于 2025-9-26 17:38:27


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

不要乱花钱 发表于 2025-9-27 10:10:58

0.不懂
1.
2.
3
4.可
5
6
7
8

llla..a 发表于 2025-9-27 11:06:42

西瓜凌 发表于 2025-9-27 11:24:42


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

雪景式小式 发表于 2025-9-27 11:45:37

11

whoim 发表于 2025-9-27 15:22:18

答案
页: 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 [2116] 2117 2118 2119 2120 2121 2122 2123 2124 2125
查看完整版本: S1E2:第一个程序 | 课后测试题及答案