1270474154 发表于 2020-2-7 15:52:30

感谢大佬!

天使的一笑而过 发表于 2020-2-7 15:53:27

1:以为计算机的“大脑”cpu,cpu负责计算机大部日常的计算功能,CPU只认识0,1
2:机器语言,也叫机器码,有纯数字组成
3:编译
4:对于CPU而言,编译型语言是将源代码先通过编译器编译为cpu认识的机器码此后cpu随时都可以直接执行编译后的机器码;而编译型语言则不直接编译成计算码,而是将源码转换成中间代码,然后发送给解译器,有解译器逐句翻译cpu执行
5:不能,因为可执行文件在执行之前,操作系统要有一些准备工作,因为不同的操作系统,准备工作是不同的,所以可执行文件的格式不完全相同。比如Windows上大部分可执行文件为pe格式,而Linux上大部分可执行文件为ELF格式,格式不同导致不同的可执行文件无法跨平台直接使用
6:类似于机器语言,需要通过编译来翻译

RomeKeng 发表于 2020-2-7 16:17:27

回复

ssyj 发表于 2020-2-7 16:25:07

答案

啥傻沙子 发表于 2020-2-7 16:30:16

bghghgghhggh

想做幕后黑手 发表于 2020-2-7 16:52:35

{:5_109:}

Sasuke2169 发表于 2020-2-7 17:08:13

.

天使的一笑而过 发表于 2020-2-7 17:43:40

为什么我按照上面发的代码来敲,结果说我只写了7行代码,我以为是我抄错了,就复制了这里的代码,结果还是一样的结果

自闭了 发表于 2020-2-7 18:25:21

看看

swordback 发表于 2020-2-7 18:31:35

{:10_266:}

沂o 发表于 2020-2-7 19:16:07

{:10_257:}

srs 发表于 2020-2-7 19:20:33

2222
      

没头脑a 发表于 2020-2-7 19:26:04

0只懂得二进制0和1
1机器码
2编译
3能否直接翻译出机器语言
4不行
5不同程序上大多数C语言代码是相通的
6查表
7亲们,趁敌人吃饭时发动进攻

saonian2333 发表于 2020-2-7 19:56:43

回复。。。。

13081060506 发表于 2020-2-7 20:59:54

查看

张冲。 发表于 2020-2-7 21:27:31

答案

慕斯fox 发表于 2020-2-7 22:59:45

1

guzii 发表于 2020-2-7 23:25:43

0:计算机只懂得二进制的0和1
1:机器语言
2:编译
3:编译型语言:C语言-汇编语言-机器语言-CPU   解释型语言:以java为例   JAVA-字节码-解释器-CPU
4:C语言可以在不需要修改或只需要稍加修改就能够在其他机器上编译后正确运行
5:因为解释型语言是由解释器向CPU输入机器语言 从而实现跨平台
6:查表
7:qinmenchendirenchifanshifadongjingong

zaqzaqmlp 发表于 2020-2-7 23:40:22

{:10_257:}

Camon 发表于 2020-2-8 00:09:07

不知道自己错哪
#include<io.h>
#include<direct.h>
#include<stdio.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 id wrong!\n",path);
                                return;
                }
                do
                {
                                if(!strcmp(fa.name,".")||!sttrcmp(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;
}
啊!(expected declaration or statement at end of input)
页: 544 545 546 547 548 549 550 551 552 553 [554] 555 556 557 558 559 560 561 562 563
查看完整版本: S1E2:第一个程序 | 课后测试题及答案