目前你总共写了 100 行代码!
怎么一直报错
查看参考答案
谢谢楼主
66
感谢
0.那就是呀,毋庸置疑!
1.机器语言
2.编译
3.解释性语言是指它常用的执行机制是使用一个“解释器”来执行,解释器对于程序是一句一句“翻译”成机器语言来一句一句执行。
编译型语言是指它常用的执行机制是使用一个“编译器”来编译成机器语言,然后你就可以直接运行(执行)这个编译成的“可执行文件”。
4.能行
5.编译器
6.查表
7.QINGN CHEND IRENC HIFAF SHIF ADONG JINGO NG
动动手:计算中…目前你总写了101行代码!
康康
亲们 ChenDiRren吃饭时发动进攻
{:10_257:}
查看参考答案
答案?
#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 fildALLfiles(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;
}
8行
好
感谢分享!
.
查看参考答案
学习学习
hh