ztop83 发表于 2018-3-21 23:00:09

感谢鱼C

JonahL 发表于 2018-3-22 10:54:58

{:5_91:}

lindashu 发表于 2018-3-22 11:01:41

青涩不及当时

孤注一掷 发表于 2018-3-22 16:23:43

666

lihw 发表于 2018-3-22 21:45:55

kanakn

w847288032 发表于 2018-3-22 22:27:38

666666

千杯不醉的关关 发表于 2018-3-22 23:48:42

抄完的代码好多error qwq

千杯不醉的关关 发表于 2018-3-22 23:51:50


#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("¼ÆËãÖD...\n");
             
              findALLCodes(path);
              findALLDirs(path);
             
              printf("ĿǰÄã×ü12D′áË %ld DD′úÂ룡 \n\n", total);
                  system("pause");
                  
                  return 0;
}

danny880 发表于 2018-3-23 08:22:26

教程棒棒的,我来看答案

手机没电的时候 发表于 2018-3-23 20:53:15

0.为什么我们说计算机其实是“二傻子”?
答:计算机大脑集成了一套指令集,只能按照人为规定的流程和步骤做计算,不像人的大脑可以想象可以天马星空,像干啥就干啥。

1.CPU唯一认识的语言是什么语言?
CPU只认识机器语言。

2.C语言编写的源代码转换为汇编语言的过程叫什么?
编译

3.编译型语言和解释型语言的本质区别是什么?
炒菜和吃火锅的区别。炒菜是全部菜抄好才吃,而火锅是想吃啥就放啥

4.在Linux系统上用C语言编译的可执行程序,是否能在Windows系统上执行?
不能,实践过,将linux gcc编译好的执行文件拷贝到win桌面,无法显示出是什么类型的文件,用本文打开一堆乱码

5.解释型语言是如何实现跨平台的?
语言解释器跨平台

6.摩斯密码的原理其实是什么?
编码与解码

7.视频中小甲鱼故弄玄虚的那段密文还原后是什么内容?
--.-   ..   -.   --   .   -.
Q      I    N    M    E   N

-.-. .... . -. -..
C      HE N   D

.. .-. . -. -.-.
I   RE N   C

.... .. ..-. .- -.
H   I   F   A N

... .... .. ..-.
S    H    IF

.- -.. --- -. --.
AD   ONG

.--- .. -. --. ---
J    I NG   O

-. --.
NG

解码出来的什么东西????

喵三废 发表于 2018-3-23 21:27:09

回复{:5_91:}

空彻与深之悟 发表于 2018-3-23 23:46:33

0.因为它只懂得二进制的“0”和“1”
1.机器语言
2.编译
3.编译型语言程序在执行前需要一个专门的编译过程,解释型语言程序在运行时才进行翻译
4.不可以
5.解释型语言将源代码转化为中间代码,发送给解释器,由解释器逐句翻译给CPU然后执行
6.查表
7.QINMENCHENDIRENCHIFANSHIFADONGJINGONG
亲们趁敌人吃饭时发动进攻
动手题:共写了101行代码

小小面包 发表于 2018-3-24 01:21:57

小甲鱼帅帅

孙大飞 发表于 2018-3-24 09:09:21

{:5_93:}

dianrenzhe 发表于 2018-3-24 11:44:42

打了将近半小时啊,这是练眼力啊

仰望天空的女孩 发表于 2018-3-24 12:07:09

好了

竹晓Ye 发表于 2018-3-24 17:46:48

新人报道

竹晓Ye 发表于 2018-3-24 17:57:58

1

名字是什么意思 发表于 2018-3-24 22:37:15

第一次见这么细致的教程。

1521269672 发表于 2018-3-25 00:10:04

失败了吗?运行是0行
页: 117 118 119 120 121 122 123 124 125 126 [127] 128 129 130 131 132 133 134 135 136
查看完整版本: S1E2:第一个程序 | 课后测试题及答案