i
S1E2:第一个程序 | 课后测试题及答案 [修改]
LOVE FISHC
F:\
0:我们几个的算计只能够识别,计算机语言如二进制的01.八进制,十六进制等。
1:CPU唯一认识的就是我们的机器语言。
2:
3:编译型语言不需要借助解释器
4:能,应为都是用C语言的符号来进行编写的。
5:在认识平台上只要有解释型编程语言的解释器就能够进行转化,
6:讲我们能够识别的信息通过一定的规律转化成我们不能识别的信息
7.qinmenchendirenchifanshifadongjingong
大一了,来晚了,不过我要努力学
kankan
回复看答案
1st
6666666666666666666666666
我做完啦!
{:5_90:}
0.计算机只有二进制0和1
1.机器语言
2.
查看参考答案
查看答案
?
0 CPU是计算机的大脑,CPU只能读懂二进制的0和1.
1 CPU能将0和1的组合跟具体的指令挂钩,这些0和1的组合成为机器码,也叫机器语言,属于第一代编程语言,也是CPU唯一可以读懂的语言
2 编译器将C语言编写的源代码转换为汇编语言的过程叫编译
3 编译型语言最终编译成机器语言,也就是可执行文件,从此CPU就可以直接执行;解释型语言不直接编译成机器语言,而是将源代码转换成中间代码,然后发送给解释器,由解释器逐句翻译给CPU执行。
4 C语言可移植性高,不需要改动或者稍加修改就可以在其他机器上编译后正确执行。
5 解释型语言时将源代码转换成字节码,然后发送给解释器,编译器逐句翻译给CPU执行,每执行一次翻译一次,以实现跨平台功能。
6 摩斯密码的原理是查表,将明文对着编码表翻译为点横组合的过程称为编码,将点横组合解密回原文的过程称为解码。
7 呆了,老外看不懂,我好像也没看懂
呜呜呜我觉得我是照抄的了,但是运行出来结果还是不一样,求帮忙看看。
下面是代码
运行结果是写了10行代码{:5_107:}
#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;
}
1111
1