答案
1
{:10_249:}
{:5_103:}
错误
答案
学习
1
图片地址怎么写啊
1
查看答案
查看参考答案
QAQ
很好
1
0.计算机只能识别0和1
1.机器语言
2.编译
3.是否需要经过翻译器翻译
4.应该能
5.将源码转换成中间代码由cpu翻译
6.莫斯编译表(查表)
7.没想出来
Finmen
Chend
Irenc
hifan
shif
adong
jingo
ng
本帖最后由 WhateverLF 于 2024-3-18 15:54 编辑
0. 为什么我们说计算机其实是“二傻子”?
0:因为计算机只能看懂机器语言,其他语言需要进行转换成机器语言才能被计算机所识别
1. CPU 唯一认识的语言是什么语言?
1:机器语言
2. C 语言编写的源代码转换为汇编语言的过程叫什么?
2:编译
3. 编译型语言和解释型语言的本质区别是什么?
3:编译型语言是整体编译好后供给cpu执行,而解释型语言是一边编译一边执行,可能执行代码时有的代码还没有进行编译。(做好一桌菜吃&烫火锅边烫边吃)
4. 在 Linux 系统上用 C 语言编译的可执行程序,是否能在 Windows 系统上执行?
4:可以,c语言的特点之一就是可移植性高
4(订正):不能。因为可执行文件在执行之前,操作系统要有一些准备工作,因为不同的操作系统,准备工作是不同的,所以可执行文件的格式不完全相同。比如 Windows 上大部分可执行文件为 PE 格式,而 Linux 上大部分可执行文件为 ELF 格式。格式不同导致了不同的可执行文件无法跨平台直接使用
5. 解释型编程语言是如何实现跨平台的?
5:不清楚
5(订正):解释型编程语言为每个操作系统专门定制一个解释器作为中转,因此解释器只需提供一个统一的入口即可
6. 莫斯密码的原理其实是什么?
6:查手册进行翻译
7. 视频中小甲鱼“故弄玄虚”的那段密文还原后是什么内容(中文)?
7:{:10_257:}有点懒不爱去查,因为已经看到第二节课了qvq
#define _CRT_SECURE_NO_WARNINGS 1
#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 findAllDirs(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;
}
运行结果:
计算中...
The path . is wrong!
目前你总共写了 0 行代码!
(这是对的吗)
感谢
1