shenjihua 发表于 2023-7-28 14:05:42

0.因为计算机并不能理解我们的语言,只有我们将操作转换为二进制他才能理解。
1.机器语言
2.编译
3.区别为不直接编译成机器码,解释型语言会编译成中间代码。
4.不能
5.通过解释器来进行再次翻译
6.查表对字
7.qinmenchend

小猴子称大王 发表于 2023-7-28 16:42:19

参考答案

Carnegie 发表于 2023-7-28 17:39:53

代码行数出不来,0条代码

2756076654 发表于 2023-7-28 17:47:17

测试题:
0,只读的懂0和1
1,二进制语言机器语言
2,编译
3,编译型语言可直接被执行,而解释型语言要解释器翻译
4,稍加修改后可以
5,通过中间代码实现跨平台的
6,翻译
7,QINMENCHENDIRENCHIFANSHIFADONGJINGONG 亲们趁敌人吃饭时发动进攻
动动手:

Mr.morgan 发表于 2023-7-28 20:29:56

1

勿问吾名 发表于 2023-7-29 10:55:04

111

tmk010905 发表于 2023-7-29 11:59:18

1

FUNNYBOY568 发表于 2023-7-29 17:22:10

1

fish76 发表于 2023-7-29 18:32:02

为什么统计代码行数的程序一直显示为0{:10_266:}

邱智敏 发表于 2023-7-29 20:51:52

1

友人许了什么愿 发表于 2023-7-30 03:48:47

感谢

Octal 发表于 2023-7-30 11:13:53

1

LIUSHENHUA 发表于 2023-7-30 11:20:50

鱼C有你更精彩^_^

李临生 发表于 2023-7-30 11:21:24

1

1274567392 发表于 2023-7-30 11:31:52

0,只认识0和1
1,机器语言
2,编译
3,编译型语言机器可以直接识别,解释型语言需要靠解释器
4,不能
5,解释器
6,查表

1322093404 发表于 2023-7-30 14:25:42

6666666666666666

ChuaKroos 发表于 2023-7-30 15:04:38

666

我要c啊 发表于 2023-7-30 16:17:49

查看答案

Suicee 发表于 2023-7-30 16:25:37

本帖最后由 Suicee 于 2023-7-30 16:27 编辑

0.因为计算机只认识0和1,以及其组成的指令
1.第一代机器语言
2.编译
3.编译型语言编译好了可以直接在cpu上运行,而解释性是翻译一句句执行
4.可以,c语言具有移植性
5.使用不通过的解释器来跨平台的
6.字母对应莫斯电码
7.转换出来是拼音()

丙醇同学 发表于 2023-7-30 16:36:03


#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;
}
页: 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 [1923] 1924 1925 1926 1927 1928 1929 1930 1931 1932
查看完整版本: S1E2:第一个程序 | 课后测试题及答案