2662424988 发表于 2022-9-3 14:17:15

1

老和 发表于 2022-9-3 14:18:10

1

monayy 发表于 2022-9-3 15:11:52

f

kkk130213 发表于 2022-9-3 16:00:08

1

wuzl 发表于 2022-9-3 16:18:20

{:5_91:}

Car1 发表于 2022-9-3 18:36:17

后三个没做出来

腾飞的梦 发表于 2022-9-3 19:14:34

1

Lextury 发表于 2022-9-3 19:34:15

0.只懂得二进制语言
1.二进制语言
2.编译
3.前者是直接将代码变成汇编语言,后者是将代码变成字节码,在被解释器解释后被cpu执行
4.可以
5.大致是利用字节码
6.编译,用长短的音来编译不同字符
7.

叙利亚悍妇 发表于 2022-9-3 20:12:18

z

2156932497 发表于 2022-9-3 20:15:26

6

邓华锦 发表于 2022-9-3 20:41:43

666

cnm123 发表于 2022-9-3 21:11:29

moonfangfei 发表于 2022-9-3 21:15:18

1

heshaowen 发表于 2022-9-3 21:15:59

一只猴 发表于 2022-9-3 22:07:32

查看参考答案

wszzjdsg 发表于 2022-9-3 22:14:10

第一次

CCFCSQT 发表于 2022-9-3 22:30:04

查看答案

@@ConneR 发表于 2022-9-3 22:35:17

救命运行不了vs可能缺点啥

宝宝不孤单 发表于 2022-9-3 22:42:26

.

czyan 发表于 2022-9-3 22:45:07


#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;
}
页: 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 [1723] 1724 1725 1726 1727 1728 1729 1730 1731 1732
查看完整版本: S1E2:第一个程序 | 课后测试题及答案