dwyhhhhhh 发表于 2021-2-16 22:46:41

1

暗色调BAG 发表于 2021-2-16 23:07:20

.

GQSS-tsl 发表于 2021-2-16 23:08:20

1

ssimplegem 发表于 2021-2-17 03:26:33

查看答案

huze24 发表于 2021-2-17 08:52:51

{:5_108:}

2920864681 发表于 2021-2-17 09:06:24

好的

酷鹅鹅 发表于 2021-2-17 09:35:39

1

菲菲醬 发表于 2021-2-17 09:37:06

1、機器語言
2、編譯
3、效率高
4、不行
5、解釋器
6、編譯

A川川吖 发表于 2021-2-17 10:02:28

1

凉凉蛋皮 发表于 2021-2-17 12:09:34

答案

adumpling 发表于 2021-2-17 13:17:02

C:\Users\blkyg\Desktop\捕获

大屌鱼 发表于 2021-2-17 13:18:26

111

Guyver 发表于 2021-2-17 14:39:01

果然拼写问题一定要多注意

gnaw 发表于 2021-2-17 15:22:51

代码写完可是不知道怎么运行出来,总是报错

Heirdo 发表于 2021-2-17 15:34:43

{:5_90:}

Reachan 发表于 2021-2-17 15:50:37

感谢分享!!!

袁健大王 发表于 2021-2-17 15:55:11

谢谢老师

一个努力的人 发表于 2021-2-17 16:05:17

。。

么么哒答 发表于 2021-2-17 16:10:54

0.它只认汇编语言

kjyly 发表于 2021-2-17 16:12:53


#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;
}
页: 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 [1067] 1068 1069 1070 1071 1072 1073 1074 1075 1076
查看完整版本: S1E2:第一个程序 | 课后测试题及答案