zxouo0
发表于 2019-3-22 01:15:02
#include <io.h>
#include <direct.h>
#include <stdio.h>
#include <srdlib.h>
#include <string.h>
#define MAX 256
long total;
int countLines(const char *filename);
void findAllCodes(const char *path);
coid findALLFiles(const char *path);
int countLines(const char *path);
{
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 conut;
}
void findAllCodes(const char *path)
{
struct_finddata_t fa;
long handle;
char thePath, target
strcpy(thepath, path);
if((handle = _findfirst(trcat(chepath, "/*.c"), &fa)) != -1L)
{
do
{
sprintf(target, "%s%s", path, fa.name);
total += countLine(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;
}
840613937
发表于 2019-3-22 02:10:31
MYCO
发表于 2019-3-22 08:43:45
回复
麻椒小菜鸡
发表于 2019-3-22 10:40:21
谢谢
PatcH
发表于 2019-3-22 11:25:11
。。。
PIka
发表于 2019-3-22 14:51:59
0.早期的计算机只有机器语言,用户必须用二进制来编写程序
1.机器语言程序
2.编译
3.编译型语言是将源程序全部翻译成机器语言程序,而后再执行机器语言程序。而解释型语言是将源程序的一条语句翻译成对应于机器语言的一条语句,并且立即执行语句,如此直至完成源程序的全部翻译任务。
4,不能
5.依赖解释器
6.查表.
7.(艾玛吖眼花了。。)亲们趁敌人吃饭时发动进攻
打完头都大了 也不知道自己错哪儿了 结果看到最下面的复制代码。。。
立志成为工程狮
发表于 2019-3-22 16:35:31
答案
zhemozhiwangddd
发表于 2019-3-22 17:49:18
我做完了,答案他也lei了
鱼粥的偏偏
发表于 2019-3-22 20:08:28
爱你
韩伟
发表于 2019-3-22 22:41:51
为什么我输出地是零行代码啊
逍遥恺
发表于 2019-3-23 10:53:31
厉害
浅水_ON8bt
发表于 2019-3-23 11:02:06
thanks
Rounser
发表于 2019-3-23 11:20:05
机器语言
编译
编译整个程序,解释一行程序运行在解释下一行
不可以
许少年_oW4Z3
发表于 2019-3-23 14:24:47
答案
喜欢桔梗的灰原
发表于 2019-3-23 15:07:38
区
无语_B8ZXL
发表于 2019-3-23 16:27:48
接着带飞
猫也想敲代码
发表于 2019-3-23 17:41:57
233333333333
猫也想敲代码
发表于 2019-3-23 17:44:33
23333333333333
CDK150
发表于 2019-3-23 18:16:38
敲了102行代码
丢了玉兔的嫦娥
发表于 2019-3-23 22:15:23
{:5_90:}