lsw6221855 发表于 2020-1-30 22:35:56

666666666666666

落拓 发表于 2020-1-30 22:48:15

答案

不加辣 发表于 2020-1-30 22:54:33

看一看

yexing 发表于 2020-1-30 23:14:49

测试题:
0.
因为计算机只认识二进制语言(机器码)
1.
机器码
2.
编译
3.

4.
不可以
5.

6.
接收密码,按照指令表进行翻译
7.
QINMEN
CHEND
IRENC
HIFAN
SHIF
ADONG
JINGO
NG
(???一脸懵逼)

动动手:

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

小刘小刘 发表于 2020-1-30 23:27:28

复制过去运行不了欸QwQ

1145600084 发表于 2020-1-31 00:26:53

计算中 你总共写了107行代码!

封北安 发表于 2020-1-31 00:32:21

1

小鹭鹭女神 发表于 2020-1-31 02:39:25

{:5_100:}

唐小错 发表于 2020-1-31 07:46:03

看看答案啦

姜维全 发表于 2020-1-31 09:07:40

新人小白在线学习

晦朔菌 发表于 2020-1-31 10:05:24

0.计算机只识别二进制代码
1.机器语言(二进制代码)
2.编译
3前者可被柯贝计算机识别并运行,后者只是给人看的
4.可以
5.将源代码转化为中间码,发送给解释器,由解释器翻译给CPU
6.查表编码解码
7.qi men chen di ren chi fan shi fa dong jin gong

wyywang 发表于 2020-1-31 10:23:53

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


Process finished with exit code 0

菜鸟上分 发表于 2020-1-31 10:35:05

0000

shero五行缺金 发表于 2020-1-31 10:40:55

66666666

被丢下的节操 发表于 2020-1-31 10:52:14

答案是什么

陌上花凉凉 发表于 2020-1-31 11:02:54

我爱鱼C

李多星 发表于 2020-1-31 11:25:02

1

小菜鸟z 发表于 2020-1-31 11:27:21

感觉错的有点多

会计师琳琳 发表于 2020-1-31 11:48:57

1.汇编语言
2.编译
3.有无调用内存
4.不能
5.虚拟机
6.01
7.none

FrancisLee 发表于 2020-1-31 12:06:50

printf("完成");
页: 525 526 527 528 529 530 531 532 533 534 [535] 536 537 538 539 540 541 542 543 544
查看完整版本: S1E2:第一个程序 | 课后测试题及答案