想知道
hello world
查看参考答案
完成
{:10_277:}
1
好难好多报错
0. 只识别0和1
1.机器语言
2.编译
3.可不可跨平台
4.不可
5.解释器
6.字符频率
7.
QINMEN
CHEND
IRENC
HIFAN
SHIF
ADONG
JINGO
NG
#include<stdio.h>
#include<direct.h>
#include<io.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("目前你总共写了%ld行代码\n\n", total);
system("pause");
return 0;
}
嘿嘿嘿
;
看看答案
0:计算机只懂0和1;
1:机器语言;
2:编译;
3:后者需要翻译;
4:可以;
5:解释器;
6:编码,解码;
1
好耶
system(“pause”)的system是个未定义标识符。。。
开始学习了
1
1
666