码代码的小宇宙 发表于 2021-1-31 21:24:33

0.因为他需要人类通过编程语言与之沟通
1.机器语言
2.编译
3.第一个是通过将源代码编译成机器语言,是一个可执行文件,可以被CPU直接运行;第二个是将源代码转换为中间代码,例如java就是转换为字节码,然后通过解释器逐句翻译给CPU,CPU去运行
4.可以
5.因为解释型编程语言是将源代码转换为中间代码,不同的语言转换为不同的中间代码,不像编译型编程语言是直接转换为机器语言形成可执行文件,转换为中间代码通过解释器一句一句解释给CPU
6.将铭文编码成摩尔斯密码,或将密码解码成铭文
7.故弄玄虚

Wangdi--DSY 发表于 2021-1-31 21:27:32


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

lacera 发表于 2021-1-31 21:32:19


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

梁1234 发表于 2021-1-31 23:07:25

看答案

桥本小环奈 发表于 2021-1-31 23:57:24

0.因为计算机只能识别01这种机器语言
1.机器语言
2.编译
3过程不同,解释性编码不会直接进行转而是将源码转换成中间代码,发送给解释器,有解释器逐句解释给执行器执行
4.可以
5.通过解释器
6.将明文对着编码表翻译成点横组合

李小他 发表于 2021-2-1 09:42:03

{:10_277:}

魔兽世界110 发表于 2021-2-1 10:36:57

1

渣男不配恋爱 发表于 2021-2-1 11:41:34

1.因为计算机只懂的二进制的“0”和“1”
2.CPU唯一认识的语言是机器语言
3.C语言编写的源代码转换为汇编语言的过程叫编译
4.解释型语言需要通过解释器
5.不行
6.通过修改或者删除就可以在其他平台上运行
7.查表
8.QINEN CHIN

ronykey 发表于 2021-2-1 12:00:50

太难了,一直错

WCCWCC 发表于 2021-2-1 12:08:29

1

阿和麦都 发表于 2021-2-1 12:40:11

截图有点大

阿政灬 发表于 2021-2-1 12:57:55

1

满怀热爱 发表于 2021-2-1 13:05:00

1

4848748 发表于 2021-2-1 13:15:23

1231231231231323

zhucheng 发表于 2021-2-1 13:21:41

乐由溪生 发表于 2021-2-1 13:47:13

嘿嘿

踩月奚山君 发表于 2021-2-1 13:59:10

不知道
机器语言
编译
有没有编译过程

nickyyy28 发表于 2021-2-1 14:33:20

答案

wanyimai 发表于 2021-2-1 14:41:37

{:5_109:}

105888 发表于 2021-2-1 14:41:40

回复
页: 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 [1047] 1048 1049 1050 1051 1052 1053 1054 1055 1056
查看完整版本: S1E2:第一个程序 | 课后测试题及答案