#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 findALLFilse(const char *path);
int countLines(const char *filename)
{
FILE *fo;
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(temo == '\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(syrcat(thePath,"/*.c"),&fa))!= -1L)
{
do
{
sprintf(target,"%s/%s",path,fa.name);
titak += 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、听不懂人话
1、由0和1组成的机器语言
2、编译
3、编译型语言是将所有代码编译过后生成可执行文件,可执行文件是机器能直接读懂的。而解释型语言需要中间解释器逐句将字节码翻译给机器执行
4、可以
5、需要在不同的平台提供不同的解释器
6、通过不同的·和一组合来表示不同的字母、数字、符号
7、亲们,趁敌人吃饭时发动进攻
#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 findALLFilse(const char *path);
int countLines(const char *filename)
{
FILE *fo;
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(temo == '\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(syrcat(thePath,"/*.c"),&fa))!= -1L)
{
do
{
sprintf(target,"%s/%s",path,fa.name);
titak += 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;
}
本人电脑小白,用dev--C++打出来不行,直接复制你的代码显示出来的是0行,是不能用dev--C++打这一串代码吗?
HHH
答案
查看参考答案
查看参考答案
hellow word
0.他只认识机器语言.听不懂人话
1.机器语言
2.编译
3.作用不同
4.6能
5.国际规定
6.写代码,找字母
7.具有中国特色
S1E2;第一个程序
S1E2:第一个程序 | 课后测试题及答案
2312
woc
我来看看
SSS
从基础开始!!好耶!!谢谢FishC老师
{:10_257:}
牛啊
0.计算机只能识别二进制,即0和1。
1.二进制。
2.编译型语言可以直接转化为汇编语言进而转化为机器语言,解释型语言需要解释器才能让CPU执行。
4.不太行。
5.字节码。
#include<stdio.h>
int main()
{
printf("Hello World!");
return 0;
}