测试题:
static/image/hrline/1.gif
第0题的答案:因为计算机只懂二进制比特位0和1,以及0和1组成的指令,其他啥也读不懂
第1题的答案:机器语言,就是0和1组成的指令
第2题的答案:叫做编译
第3题的答案:编译型语言是把代码翻译成汇编语言再翻译成机器语言,而解释型语言则是现将源码转换为中间代码,再将中间代码发送到解释器,最后由解释器翻译成机器语言
第4题的答案:大部分程序都可以在linux里面执行,但在linux系统里面C语言有更广阔的天地
第5题的答案:它不直接编译成机器码,而是将源码转换成中间代码,然后发送给解释器,由解释器逐句翻译给 CPU 来执行
第6题的答案:原理是像机器语言一样,摩斯密码可以以点横的方式组成密码,然后再通过特定的表破译
第7题的答案:汉语拼音:qin min chen di ren chi fan shi fa dong jin gong 汉语:亲民趁敌人吃饭时发动进攻?
static/image/hrline/1.gif
动动手:
static/image/hrline/1.gif
答案:
#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;
}
大概没错吧^_^
d
答案
?
1
回复
Emmmm
S1E2:第一个程序 |课后测试题及答案 [修改]
高级模式
1
{:5_109:}C:\Users\admin\Desktop\图片\甲鱼s1s2
11
0
buzhidao
666666
测试题答案
看答案啦
{:5_97:}
1
甲鱼你好呀~
打了快一个点才打完…打卡