我只有计算中没有显示多少行代码
#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 dile:%s\n",filename);
return 0;
}
while((temp = fgetc(fp)) != EOF)
{
if (temp == '\n')
{
count++;
}
}
fclosr(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 mainn()
{
char path = ".";
printf("计算中...\n");
findALLCodes(path);
findALLDirs(path);
printf("目前你总共写了%ld 行代码!\n\n", total);
system("pause");
return 0;
}
为啥运行不了,求教教
0.只能识别0和1的二进制
1.机器语言
2.编译
3.编译型语言被编译成机器语言后CPU即可执行,解释型语言每次运行前需要解释器解释
4.可以
5.运行前解释
6.不同字符对应不同编码
7.QINMEN CHEND IRENC HIFAN SHIF ADONG JINGO NG
亲们趁敌人吃饭时发动进攻
1
答案
课后测试题及答案
11
111111
您好
编译了三遍啊三遍,终于没报错了
是是有一个程序正在运行了,可能是写完之后拿答案对照时不小心把答案运行了,但是原来的那个怎么关掉呢?
看看答案
0. y因为计算机只能识别机械语言。我们想要让计算机了解我们的意图需要将我们的语言转化成机械语言它才能看懂执行。
1.汇编语言
2. 编译
3.编译型语言不需要编译器的伴随,解释型语言需要编译器的伴随。
4.能
5.将程序拿到其他平台上然后再下载所需要的解释器即可。
6.莫斯密码采用的是短脉冲和长脉冲的形式,通过它们的组合,可以产生字母或数字。
7.QINMENCHENDIRENDIRE
只能识别0和1
qqq
。
QINMENCHENDIRENCHIFANSHIFANDONGJNGONG
66
查看参考答案
已完成