答案
#include<io.h>
#include<direct.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX 256
总数;
int countLines(const char * filename);
void findAllCodes(const char * path);
void findAllFiles(const char * path);
int countiLines(const char * filename)
{
FILE * fp;
int count = 0;
int temp;
if ((fp = fopen_s(filename, "r") ) == NULL)
{
fprintf(stderr, "无法打开文件:%s\n", filename);
return 0;
}
while ((temp = fgetc(fp)) != EOF)
{
if (temp == '\n')
{
总数++;
}
}
FCLOSE(fp);
return 总数;
}
void findAllCodes(const char * path)
{
struct _finddata_t fa;
int handle;
char thePath, 目标,总计;
strcpy_s(thePath, path);
if ((handle = _findfirst(strcat_s(thePath, "\*。c"), &fa)) != -1L)
{
{
sprintf_s(目标,"%s/%s",path,fa.name);
总计+= countLines(目标);
}while (_findnext(handle, &fa) == 0);
}
_findclose(handle);
}
void findAllDirs(const char* path)
{
struct _finddata_t fa;
int handle;
char thePath;
strcpy_s(thePath, path);
if ((handle = _findfirst(strcat_s(thePath, "/ *"), &fa)) == -1L)
{
fprintf(stderr, "路径%s错了!\n", thePath);
return;
}
{
if (!strcmp(fa.name,"。") || !strcmp(fa.name,".."))
if (fa.attrib == _A_SUBDIR)
{
sprintf_s(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("目前你总共写了%d行代码!\n\n", 总计);
system("pause");
return 0;
}
打卡!
qinmenchendirenchifgshfanonGwingong
不会啊
666666666666666
回复回复
测试题
0
因为计算机只认识0 1 这样的二进制机器码
1
机器语言
2
编译
3
编译型语言直接通过编译器编译成机器语言送给计算机
而解释型语言首先编译成中间代码 再通过解释器一句一句解释给计算机
4
阔以吧毕竟C语言可移植性强
5
通过中间代码送给不同的解释器吧我猜
6
莫斯密码的原理其实就是编码
7
I love FishC.com
dds
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("目前你总共写了%d行代码!\n\n",total);
system("pause");
return 0;
}
查看答案
111
{:5_106:}
0
看看啊
第一次作业
感谢小甲鱼的良苦用心,新人小白拜谢!
1111
小甲鱼我爱你
0.只会读取
1.机器码
2.C语言编程
3.解释型语言不会直接编译成机器码,要经过转换器
4.能
5.由字节码发到解释器
6.查找指令表
7.qinmen nnhend lrend hlfan shlf adong jlngd ag
zz
少时诵诗书