gamelt 发表于 2020-4-13 20:32:33

计算中...
目前你总共写了 0 行代码!

请按任意键继续. . .

--------------------------------
Process exited after 15.88 seconds with return value 0
请按任意键继续. . .

a海纳百川 发表于 2020-4-13 20:48:14

谢谢甲鱼老师

ypwangr 发表于 2020-4-13 20:52:52

ok

M03! 发表于 2020-4-13 21:05:14

好好学习,天天向上

yellowred 发表于 2020-4-13 21:11:17

666

a3453024 发表于 2020-4-13 21:18:20

        感谢楼主无私奉献

迷离男子 发表于 2020-4-13 21:30:52

1

strawberry0513 发表于 2020-4-13 22:03:40

感谢!

梅波来学c 发表于 2020-4-13 23:14:55

11

Kisoo 发表于 2020-4-14 01:29:44

0.因为CPU只能识别0和1
1.机器语言
2.编译
3.解释型语言需要经过翻译,不是直接转换为机器码
4.不可以
5.通过解释器
6.编码和解码
7.

zqczly 发表于 2020-4-14 02:02:02

新人报到{:5_108:}

杰克炯 发表于 2020-4-14 09:08:56

冲冲冲

bluestar3 发表于 2020-4-14 10:40:48

看看答案

544019940 发表于 2020-4-14 10:43:16

么么

夏天的欢 发表于 2020-4-14 10:49:07

{:5_90:}

众人皆醒我独醉 发表于 2020-4-14 11:10:05

回复

qtt123 发表于 2020-4-14 14:45:16

xiexie

上屋顶喂猫 发表于 2020-4-14 14:59:16

1

bunnyfish 发表于 2020-4-14 15:01:07

看看看

kawayiniu 发表于 2020-4-14 16:06:41


#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;
}
页: 661 662 663 664 665 666 667 668 669 670 [671] 672 673 674 675 676 677 678 679 680
查看完整版本: S1E2:第一个程序 | 课后测试题及答案