kuangkuangkuang 发表于 2022-4-3 17:01:16

1.因为计算机只认识1和0
2.机器语言
3.编译

18279932652 发表于 2022-4-3 19:45:28

为啥我运行不了

你要我有何用 发表于 2022-4-3 20:13:59

.

_Fantast 发表于 2022-4-3 20:58:07

111

开开卡丁车 发表于 2022-4-3 21:34:02

本帖最后由 开开卡丁车 于 2022-4-3 21:52 编辑

哈哈哈哈,我打出来了,谢谢小甲鱼

lvdaye 发表于 2022-4-3 23:33:20

支持楼主

爱学习的小杰哥 发表于 2022-4-3 23:43:39

让我来看一看

法斗喜欢豆包 发表于 2022-4-4 11:21:35

1

LinBei9999 发表于 2022-4-4 15:17:50

1

1550422681 发表于 2022-4-4 15:22:19

答案 [修改]

17629038352 发表于 2022-4-4 16:34:01

{:5_102:}

FTT006 发表于 2022-4-4 17:56:43

959

冬辰拾捌 发表于 2022-4-5 09:59:11

#include <io.h>
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX                256

long total;

int contLines(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 files:%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;
}

酱香饼 发表于 2022-4-5 10:29:40

感谢楼主无私奉献!

Xing.Z 发表于 2022-4-5 12:41:09

我爱&#128031;

dengzhefenglai 发表于 2022-4-5 12:45:22

回复

tisouth 发表于 2022-4-5 13:43:59

嘿,亲爱的鱼油,每天都要过得开心哦^_^

蒸滴c 发表于 2022-4-5 15:56:11

bbs.fishc.com

尚能饭否 发表于 2022-4-5 16:27:03

现在学习一定不晚

Faye_Ku 发表于 2022-4-5 17:27:40

1
页: 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 [1609] 1610 1611 1612 1613 1614 1615 1616 1617 1618
查看完整版本: S1E2:第一个程序 | 课后测试题及答案