1216381510 发表于 2021-4-1 17:36:37

1

小陈血c 发表于 2021-4-1 17:53:00

111

皮皮虾爱打篮球 发表于 2021-4-1 18:09:28

我就想看看啥是答案

yuyufei7 发表于 2021-4-1 18:33:35

就看看

CJ1234 发表于 2021-4-1 19:21:28

k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案k看答案

落单riki君 发表于 2021-4-1 19:21:44

只认识二进制
机器语言
编译
让人读和让机器读

编译
事先配置好对应的关系
qinmenchendirenchifanshifadongjingjingong亲们趁敌人吃饭时发动进攻

土木的码农 发表于 2021-4-1 19:27:07

daan

dwdave 发表于 2021-4-1 20:17:58

没成功 看看答案吧

晴~天 发表于 2021-4-1 20:18:03

为啥显示的是零行呀

sl985595366 发表于 2021-4-1 20:25:04

66

大熊猫带我飞 发表于 2021-4-1 21:02:16

1

2222ex 发表于 2021-4-1 21:41:34

1

青门绿衣坊 发表于 2021-4-1 22:13:44

支持甲鱼!!

DRC666 发表于 2021-4-1 23:11:35

答案

神崎凛 发表于 2021-4-1 23:33:04

123

神崎凛 发表于 2021-4-1 23:56:20

您好!为啥我windows系统抄的代码运行后显示0行代码,而且复制粘贴您写好的代码运行后也是显示已写0行代码

HelloDany 发表于 2021-4-2 00:02:22

PS E:\VSCode\projects\demo> .\demo.exe
璁$畻涓?..
鐩墠浣犳

一直迷失的海豚 发表于 2021-4-2 00:40:35

#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_AUBDIR)
                {
                        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;
}

求大佬看看我到底哪抄错了,怎么这个程序就是出不来{:5_100:}

噢利给 发表于 2021-4-2 09:51:56

新人

罗楚鑫 发表于 2021-4-2 10:49:47

1
页: 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 [1141] 1142 1143 1144 1145 1146 1147 1148 1149 1150
查看完整版本: S1E2:第一个程序 | 课后测试题及答案