第一节课
lkj
0.因为它只会按照固定的程序运行
1.机器语言
2.编译
3.不知道
4.不能
5.不知道
6.不知道
7.不知道
0.
只懂得机器语言
1.
机器语言
2.
编译
3.
编译型语言,需要经过编译成汇编语言再转换成机器语言,cpu直接就能读懂
解释型语言,需要将全部代码逐句解释给cpu
因为编译型语言比解释型效率更高
4.
当然可以
5.
因为不需要编译,直接解释给cpu
6.
查表
7.
亲们,趁敌人吃饭,是发动进攻
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;
}
daan
做完了,查看参考答案
为什么我编译结果是285行代码{:10_266:},复制那个文本代码上去,结果也是285,我不理解{:10_269:}
先写再看
1
查看参考答案
1
11
{:10_277:}
为什么我的运行结果是0行啊{:10_277:}file:///D:/%E9%85%B1%E6%B1%81%E6%B2%B9%E9%BA%A6/Screenshots/31.png
为什么我用vs2019打出来都是错误呢?"C:\Users\86132\Desktop\微信图片_20221104234117.jpg"
来啦
{:5_109:}
0.他只能读懂0和1
1.机器语言
2.编译
3.编译型语言可以直接被CPU所执行
4.可以
5.通过解释器进行翻译
6.查表
7.
查看参考答案
认真