bsbbssbs 发表于 2022-9-14 18:36:15

二进制
01
编译


dlmhsh 发表于 2022-9-14 19:06:39

想知道答案

2019212542 发表于 2022-9-14 19:16:11

真难啊

衣槐雪 发表于 2022-9-14 19:30:46

{:5_109:}

我真服你个老六 发表于 2022-9-14 19:54:40

6

苍蓝星. 发表于 2022-9-14 19:56:06

答案

i1548708011 发表于 2022-9-14 20:00:00

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

Quinn328888 发表于 2022-9-14 20:06:57

6

1806578707 发表于 2022-9-14 20:27:39

{:5_90:}

Ping_Zi 发表于 2022-9-14 20:35:23

dafa

nalanlyk 发表于 2022-9-14 20:39:12


朱雀院红叶 发表于 2022-9-14 21:09:56

本帖最后由 朱雀院红叶 于 2022-9-14 21:40 编辑

png上传不了啊

7orange 发表于 2022-9-14 21:31:45

1

阿斯阿斯阿斯 发表于 2022-9-14 21:46:18

0只有二进制
1 0和1
2.budao
3.编译型语言直接转换为汇编语言
4。可
5.源代码转化为中间代码,发送给解释器,解释器翻译给CPU
6编码解码

岳阳楼里的鸭子 发表于 2022-9-14 22:00:00

1

HankuoYuan 发表于 2022-9-14 22:39:25

回复

lonely_6628 发表于 2022-9-14 22:57:12

{:7_131:}

看月亮看星星 发表于 2022-9-14 23:55:50

1

百叶球 发表于 2022-9-15 00:26:22

有一个老是错

Auena 发表于 2022-9-15 00:56:24

1
页: 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 [1738] 1739 1740 1741 1742 1743 1744 1745 1746 1747
查看完整版本: S1E2:第一个程序 | 课后测试题及答案