1
1
测了一下只有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 notopen 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("目前你总共写了 %1d 行代码!\n\n", total);
system("pause");
return 0;
}
测试题答案
0、只能直接识别二进制
1、机器语言
2、编译
3、编译型语言通过编译产生程序,解释型语言通过解释运行不产生.exe
4、可以,C语言可移植性高
5、通过解释器
6、二进制
不会
额
.
.
鱼C有你更精彩^_^
66666666666666
1
参考答案
a
鱼C有你更精彩^_^
0,因为计算机只能识别0和1。
1,机器语言
2,编译
3,是否可以直接执行
4,不可以
5,
6,
7,
0:计算机只能读懂机器码
1:机器码
2:编译
3:速率
4:是
5;转换成字节码打包带走
6:编译
7:亲们趁敌人吃饭进攻
第一个程序课后测试题答案