番茄laosp 发表于 2020-12-9 17:37:59

long taotal;

int countLinescapable(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 notopen 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 hanble;
       
        char thePath,taeget;
       
        char (thePath,path);
        if (handle=_finbfirst(strcat(thePath,"/*.c"),&fa))!=-1L)
        {
                do
                {
                        sprintf(target,"%s/%s,path,fa,name");
                        total+=countLines(target);
                }while (_findnext(handle,&fa)==0);
        }
        _finbclose(handle);
       
}

void findALLDirs(const char *path)
{
        strut_finddata_t fa;
        if((handle=_findfirst(strcat(thePath,"/"),&fa))==-1L)
        {
               
                fprintf(stberr,"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(hanble);
             
}

int main()

{
        char path=".";
       
        printf("计算中...\n");
       
        findAllCodes(path);
       
        finALLDirs(path);
       
       
        printf("目前你总共写了%ld 行代码/n/n",total);
       
        system("pause");
       
        return 0;
}

14        1        C:\Users\番茄\Desktop\未命名1.cpp        expected unqualified-id before '{' token

这问题还多吧

Yraine 发表于 2020-12-9 19:03:50

查看答案

fried31 发表于 2020-12-9 19:09:21

来了!

撒反对 发表于 2020-12-9 21:55:20

我想看看答案

laohumghj 发表于 2020-12-9 21:55:57

加油 每天坚持学习

luoyangyang 发表于 2020-12-9 22:00:14

啊啊啊

小白菜鱼 发表于 2020-12-9 23:06:21

1

zhangfukua 发表于 2020-12-9 23:32:42

kkk

cxw666 发表于 2020-12-10 00:52:33

本帖最后由 cxw666 于 2020-12-10 00:55 编辑

敲了好久,

口袋迷zy 发表于 2020-12-10 01:31:05

0. 计算机只认识0和1.
1. 机器语言(机器码)
2. 编译
3. 编译型:效率高、灵活度高、可移植性高。解释型跨平台特性、效率相对低。
4. 不行,需要重新编译。
5. 解释型语言与平台联系小,只要解释器就能在不同平台上解释运行。
6. 编码解码过程。
7. qin men chen di ren chi fan shi fa dong jin gong
    亲们趁敌人吃饭时发动进攻!

djsandi 发表于 2020-12-10 06:33:26

11111111

雷欧库珀 发表于 2020-12-10 10:00:14

我用vscode编译完 不会跳出黑框,而是弹出警告。这是为什么

15586965211 发表于 2020-12-10 10:08:08

真想知道

如风常伴 发表于 2020-12-10 10:54:03

打卡。。。。。。。。。。。

小狐栗 发表于 2020-12-10 14:56:56

1

yummyiwy 发表于 2020-12-10 15:59:07

xxxx

Ayeung 发表于 2020-12-10 16:44:42

看一看

ywx360 发表于 2020-12-10 17:04:36

看答案

paulzx 发表于 2020-12-10 17:06:28

zhende想知道

ly13967 发表于 2020-12-10 17:27:34

第72行和17行总是错哦,我实在找不出来。
页: 966 967 968 969 970 971 972 973 974 975 [976] 977 978 979 980 981 982 983 984 985
查看完整版本: S1E2:第一个程序 | 课后测试题及答案