RE: S1E2:第一个程序 | 课后测试题及答案
进攻! 计算机无法直接读懂人类语言机器语言
编译
编译型语言是通过编译转换成汇编语言再转换为机器语言,交由CPU执行,而解释型语言是转换为中介代码,再由解释器翻译成机器语言
可以
将源代码转化成中介代码再交由解释器翻译
查表
QIN MEN CHEN DI REN CHI FAN SHI FA DONG JIN GONG
亲们趁敌人吃饭时发动进攻 {:5_92:} 本帖最后由 WQ海阔天空 于 2018-1-22 21:33 编辑
目前,你总共写了0行代码。。。
我把源代码复制下来对比,不一样的地方都改了啊,怎么还是提示写了0行代码呢?
每行前面的空格多少不影响代码运行吧?
#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;
}
明天重新写一下再试 QAQ 0.计算机只认识0和1
1.机器语言
2.编译
3.编译型语言cpu能读懂,解释形语言需要解释器转换
4.能
5.解释器转换
6.01的排列
7. i love fishc.com 0.计算机只认识0和1
1.机器语言
2.编译
3.编译型语言cpu能读懂,解释形语言需要解释器转换
4.能
5.解释器转换
6.01的排列
7. i love fishc.com 查看答案 qin men cheng irenchieanshifadongjingoag 1 啊 回复一下看答案 感谢楼主喽 。。。
{:5_91:} 答案 撒 这帖子不错哦 0. 只能读懂机器语言
1. 汇编
2. 编译
3. 需不需要解释器
4. 能
5. 解释器
6. 一一对应
嘻嘻