飞鸟梦时代 发表于 2021-1-9 11:22:08

加油

好人不败 发表于 2021-1-9 11:48:22

这也有答案?

好家伙w 发表于 2021-1-9 12:17:35

kk

Zh21 发表于 2021-1-9 12:58:53

查看参考答案

源朔 发表于 2021-1-9 14:01:50

en

爱娜呐 发表于 2021-1-9 15:05:13

查看参考答案

celebrate 发表于 2021-1-9 15:32:51

109行

思考人生 发表于 2021-1-9 15:53:45

1

溪水叮咚 发表于 2021-1-9 15:57:55

666666666

Oxyge 发表于 2021-1-9 16:37:37

1

猫秋 发表于 2021-1-9 16:42:06


#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;
}

kuangwei 发表于 2021-1-9 19:15:59

S1E2:第一个程序 | 课后测试题及答案

2022CCCCC 发表于 2021-1-9 21:19:20

{:5_109:}

bugu333 发表于 2021-1-9 23:30:02

1

字小白 发表于 2021-1-9 23:49:02

0.因为他就知道0和1
1.机械语言
2.编译
3.有无解释器
4.一部分可以吧
5.解释器
6.查表
7.qinmechendirendchifanshifadongjingong

koi_white 发表于 2021-1-10 01:09:11

第一节课 打卡

GuoZelin 发表于 2021-1-10 02:17:58

感谢~

vividccccc 发表于 2021-1-10 10:45:27

1

TouristI 发表于 2021-1-10 10:55:59

1

Viior 发表于 2021-1-10 10:56:01

0.因为计算机只能识别机器语言,无法识别其他语言
1.机器语言
2.编译
3.编译型语言不需要再进行编译器的转换,运行速率更快;解释型语言需要经过编译器进行转换成计算机能读懂的语言,运行速度更慢。
4.不能
5.忘了
6.根据已有的识别编码一一对应
7.有点费事,懒得对了
页: 994 995 996 997 998 999 1000 1001 1002 1003 [1004] 1005 1006 1007 1008 1009 1010 1011 1012 1013
查看完整版本: S1E2:第一个程序 | 课后测试题及答案