问黎明 发表于 2019-1-28 16:33:13

看看答案对不对。。。

丨HAKU丨 发表于 2019-1-28 17:30:17

0.0

心跳酱 发表于 2019-1-28 18:22:16

答案

鱼跃在花见 发表于 2019-1-28 22:22:52

本帖最后由 鱼跃在花见 于 2019-1-28 22:24 编辑

0.只认识 01
1.计算机语言
2.编译
3.编译:编译>汇编>计算机>CPU;解释:?>字节>(解释)>CPU
4.能
5.?
6.翻译
7.?

yxlu271815 发表于 2019-1-28 22:25:38

做完了,看看答案

编程路上的小白 发表于 2019-1-28 22:49:49

果然还是需要耐心和细心才能完成,抄错了也没及时发现

鱼跃在花见 发表于 2019-1-29 00:29:39

不知道怎么发图片,谢了109行是什么情况?

a36811115 发表于 2019-1-29 01:49:25

ssssssssssssssssss

yiliangkuo 发表于 2019-1-29 11:32:07

答案答案

JohnEric 发表于 2019-1-29 11:43:28

{:5_90:}{:5_102:}

3031044415 发表于 2019-1-29 15:32:19


#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 fineALLFiles(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);
                flinALLDirs(path);
               
                printf("目前你总共写了%1d行代码!\n\n",total);
                systeam("pause");
               
                return 0;
        }
       



3031044415 发表于 2019-1-29 15:33:01

鱼哥或者各位大神能帮我看一下我哪里错了不,我看了好几遍都看不出来

孟小鱼 发表于 2019-1-29 15:57:46

Mr.zh 发表于 2019-1-29 16:28:06


1

小武bbc 发表于 2019-1-29 17:32:28

看个答案先

娜娜奇酱 发表于 2019-1-29 22:10:36

2

木下秀吉诚 发表于 2019-1-29 23:01:28


190355968 发表于 2019-1-30 00:09:12

666

qq13874303 发表于 2019-1-30 00:31:01

看答案
{:5_107:}

beutsking 发表于 2019-1-30 09:18:56

11123
页: 230 231 232 233 234 235 236 237 238 239 [240] 241 242 243 244 245 246 247 248 249
查看完整版本: S1E2:第一个程序 | 课后测试题及答案