ChiaYan 发表于 2015-12-28 20:44:17

我打完代码,显示报错,改了几次都还是这样,卡住了+但是我看不懂哪里出问题了。。。:cry

漆雕古代 发表于 2015-12-29 03:28:48

0.他什么都不会,必须我们给他下达命令

1.机器语言,01010101011001010101001

2.编译

3.编译型语言需要编译器成CPU听得懂的语言,解释型语言在解释器下可以直接被执行

4.不一定

5.解释器

6.就是翻字典查字

7.Hello FishC.com

Ar7hurK 发表于 2015-12-31 23:56:04

想知道

王晓浅1992 发表于 2016-1-1 19:14:34

:cry

禽兽H 发表于 2016-1-1 20:55:31

#include<stdio.h>

bravo 发表于 2016-1-2 21:29:49

朕想知道

艾爽爽- 发表于 2016-1-3 14:47:43

.

~风介~ 发表于 2016-1-3 16:18:01

0. 计算机只认识0和1
1. 机器语言
2. 翻译
3. 是否生成中间文件?
4. 否
5. 在os上加入自己的虚拟机(解释器)
6. 对照表
7. 用编程改变世界

b.i 发表于 2016-1-3 21:12:11

6656566

cn12580 发表于 2016-1-3 23:44:09

{:5_90:}{:5_91:}

花開丶若相惜ソ 发表于 2016-1-4 09:01:15

我是来学习的。

Litt_E 发表于 2016-1-4 11:21:58

3q!!!!!!!!!!!!!

低泡小子 发表于 2016-1-4 20:42:53

瞅瞅

norient 发表于 2016-1-4 21:21:05

a

norient 发表于 2016-1-4 22:19:28

我的怎么是113行

lianyingteng 发表于 2016-1-5 16:16:14

0. 计算机只能读懂0和1

1. 机器语言

2.编译

3. C -> 汇编语言 -> 机器语言 -> CPU

閰小梨 发表于 2016-1-7 02:35:31

0.
只懂0和1
1.
机器语言
2.
编译
3.
编译型语言会转成机器语言,可以直接给CPU执行
解释型语言是翻译成字节码,要交由解释器后给CPU执行
4.
大概有八成至完全的代码不需要修改
5.
不同平台只要下载对应的解释器即可,所以可以完全跨平台
6.
点和线的不同组合
就是查表
7.
QINMEN
CHEND
IRENC
HIFAN
SHIF
ADONG
JINGO
NG

动动手


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

ucxogmd 发表于 2016-1-7 12:05:31

{:5_90:}

ciconia 发表于 2016-1-7 20:27:29

怎么让打印结果的数字高亮显示?

ciconia 发表于 2016-1-7 20:39:42

哇哈哈啊哇哈哈,咱搞出来啦{:9_217:}
页: 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15
查看完整版本: S1E2:第一个程序 | 课后测试题及答案