simple1203 发表于 2017-4-11 09:01:27

111111111111111

冷月云殇 发表于 2017-4-11 17:22:00

0 only know machine language
1 machine language
2 compile
3 compile: source code -> compile -> object code
interpreted: source code -> intermediate code -> interpreted & run
4 no, different compiler
5 via a interpreter in different platform
6 replace
7 qinmenchendirenchifanshifadongjingong

冷夜孤辰 发表于 2017-4-11 21:45:19

纠正了好多遍错误,终于把代码敲完了。

gyc11 发表于 2017-4-12 17:31:10

参考答案

苦涩荔枝鸟 发表于 2017-4-12 20:02:18

看看~

凡凡殇清 发表于 2017-4-13 00:16:23

看看

凡凡殇清 发表于 2017-4-13 00:58:08

凡凡殇清 发表于 2017-4-13 00:16
看看

甲鱼老师,你帮我看看,我这是错哪了,

啊111 发表于 2017-4-13 19:06:37

.

lstcuso4 发表于 2017-4-13 20:26:58

{:10_256:}{:10_256:}看看答案

丶DuNk 发表于 2017-4-13 20:30:58

看。。

白沫哥 发表于 2017-4-13 21:27:13

参考答案

玉火叢生 发表于 2017-4-13 23:00:40

0.不是0就是1
1.机器码
2.编译
3.是否编译成二进制
4.不能
5.编码
7.这个算了

玉火叢生 发表于 2017-4-13 23:42:46

本帖最后由 玉火叢生 于 2017-4-14 01:10 编辑

玉火叢生 发表于 2017-4-13 23:00
0.不是0就是1
1.机器码
2.编译


#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 finaALLFiles(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("你目前总共写了%1d行代码!\n\n",total);
system("pause");
return 0;
}



结果:
$ ./countlines.exe
Press any key to continue . . .

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

can not open the file:.countlines.c
can not open the file:.hello.c
can not open the file:./test2main.c

-------------------------------------------
发现问题,最后一只卡住了
-----------------------------
Press any key to continue . . .

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

终于出来了,坑爹

流年.记忆 发表于 2017-4-14 10:08:56

看答案啦

qkk 发表于 2017-4-15 13:24:49

0.为什么我们说计算机其实是“二傻子”
因为计算机只认识0和1
1.CPU唯一认识的语言是什么语言?
二进制语言
2.C语言编写的源代码转换为汇编语言的过程叫什么?
C语言程序到二进制行程序需要经过如下步骤:
预处理:包含头文件和替换宏
编译:将预处理后的程序转化成汇编代码
汇编:将汇编代码转换成机器码
连接:将多个目标文件以及所需的库文件链接成最终的可执行文件
所以C语言编写的源程序转换为汇编语言的过程叫编译
3.编译型语言和解释型语言的本质区别是什么?
编译型语言:一次编译,多次运行
解释型语言:边编译边运行
4.在Linux系统上用C语言编译的可执行程序,是否能在Windows系统上执行?
能,可移植性强
5.解释性编程语言是如何实现跨平台的?
通过使用特定的解释器
6.莫斯密码的原理其实是什么?
不同的长短音组合('-'或'.'),代码不同的英文字母
7.莫斯密码解密
亲们趁敌人吃饭时发动进攻

Miyu 发表于 2017-4-16 10:46:36

hello world

风骚的小胖子。 发表于 2017-4-17 19:52:22

二进制傻子。

wushanbo 发表于 2017-4-18 13:06:12

计算中……。
目前你总共写了0行代码!
请按任意键继续……
————————————————
process exited after 2.308 seconds with return value 0
请按任意键继续

168工作室 发表于 2017-4-19 02:17:05

0:因为计算机只认得 0 和 1
1:机器语言- 汇编语言
2:编译
3:编译型语言进行编译一次后转换成汇编语言给计算机读 一次就可以!而解释型语言需要每次都跟计算机解释一次,计算机才能懂,所以解释型语言比编译语言的效率要低点
4:能
5:通过解释器
6: 0 和 1
7:翻译了 一个小时:亲么很仁慈发好我希望我能做到

168工作室 发表于 2017-4-19 02:18:53

看看答案
页: 53 54 55 56 57 58 59 60 61 62 [63] 64 65 66 67 68 69 70 71 72
查看完整版本: S1E2:第一个程序 | 课后测试题及答案