wlqwlq 发表于 2020-12-15 09:50:27

qq

hush56aaa444959 发表于 2020-12-15 12:01:59

支持

theMilkyWay 发表于 2020-12-15 12:23:42

see

落叶化玄 发表于 2020-12-15 14:28:12

0.只会计算0和1
1.机器语言
2.编译
3.前者CPU执行的是机器语言;后者CPU执行的是解释器提供的指令
4.可以
5.字节码将指令发送给解释器
6.摩尔斯电码是一些表示数字的点和划。数字对应单词,需要查找一本代码表才能知道每个词对应的数。用一个电键可以敲击出点、划以及中间的停顿。
7.亲们趁敌人吃饭时进攻

!TF147 发表于 2020-12-15 15:26:54

11111111

gongqy 发表于 2020-12-15 19:33:48

回复

怒良 发表于 2020-12-15 19:40:18

daan

笨鸟学飞 发表于 2020-12-15 20:33:28

52行和80行死活解决不了报错{:5_109:}怀疑人生了
python入门也没这么夸张啊

fleetingtim 发表于 2020-12-15 21:09:02

97行代码

雪天月 发表于 2020-12-15 22:10:34

小甲鱼XJY 发表于 2020-12-15 22:15:05


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

Tellsc 发表于 2020-12-15 23:00:29

感谢小甲鱼{:10_254:}

lllku 发表于 2020-12-15 23:25:32

1

pyu2018 发表于 2020-12-16 00:43:26

看看答案吧

简心^_^ 发表于 2020-12-16 10:12:58

回复

zcj0115 发表于 2020-12-16 10:23:37

做好作业看答案

起飞!- 发表于 2020-12-16 11:30:12

感谢楼主无私奉献!

起飞!- 发表于 2020-12-16 13:02:54

C:\Users\Lenovo\Pictures\Screenshots
为啥我是这样的{:10_284:}
复制粘贴也是这样

Mercurearth 发表于 2020-12-16 14:42:35

好用

nogrey 发表于 2020-12-16 14:50:24

太棒惹
页: 973 974 975 976 977 978 979 980 981 982 [983] 984 985 986 987 988 989 990 991 992
查看完整版本: S1E2:第一个程序 | 课后测试题及答案