回复
ye
答案
我想知道
查看参考答案
为什么我运行不出来,我已经把报错的地方都改了
求大佬解答为什么我已经把报错改正了还是运行不出来。
#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;
}
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)
{
spintf(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;
}
写完了看答案
{:5_102:}
0:因为计算机只认识0和1的机器码
1:机器语言
2:编译
3:编译型语言需要从汇编语言变成机器语言,而解释型语言直接转换成机器语言
4:可以
5:直接转换成机器语言可以在各个平台使用
6:将对应的字符组合查表翻译出来
7:亲们吃饭是发动机
nb
134355
总共0行代码(不知怎么上传照片)
我自己 手敲的结果 显示 总共0行代码
复制了一份还是 显示 0行代码(用的Dev)
是答案 不对嘛
感谢鱼爷!
11
课后测试题及答案
看看测试题答案
222222