blacksummer
发表于 2018-8-13 00:10:42
谢谢甲鱼
young可爱
发表于 2018-8-13 09:44:15
看答案啦
friedrichli
发表于 2018-8-13 10:58:25
fa未声明怎么办?
Xlyxcar
发表于 2018-8-13 14:50:37
0. 因为计算机只认识0和1
1. 机器语言
2. 忘了哈哈哈
3. 忘了。。
4. 不能
5. 通过不同的。。编码器?
6. 二进制
7. 不知道
AlexanderLeolin
发表于 2018-8-13 16:58:42
打卡签到
AlexanderLeolin
发表于 2018-8-13 16:59:13
0:二进制。0101
1.机器语言
2.编译
3.效率不同
4.不可以
5.不直接编码,而是转换为字节码,每次运行都要解释。
6.摩斯密码的原理就是查表。
7.亲们趁敌人吃法发动进攻
AlexanderLeolin
发表于 2018-8-13 17:01:20
本帖最后由 AlexanderLeolin 于 2018-8-13 19:20 编辑
0:二进制。0101
1.机器语言
2.编译
3.效率不同
4.不可以
5.不直接编码,而是转换为字节码,每次运行都要解释。
6.摩斯密码的原理就是查表。
7.亲们趁敌人吃饭发动进攻
ZLSTJ
发表于 2018-8-13 18:20:49
我复制代码上去为什么还是有一个错误。
GJL!
发表于 2018-8-13 21:06:59
为啥计算出的是0行{:10_243:}
金志杰
发表于 2018-8-13 21:35:38
想了解答案
thin_power
发表于 2018-8-14 16:17:53
#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("目前你总写了 %ld 行代码!\n\n",total);
system("pause");
return 0;
}
lipchen
发表于 2018-8-14 16:35:42
学习学习
molijin
发表于 2018-8-14 22:10:47
小甲鱼牛逼
crot
发表于 2018-8-15 04:24:02
11111111111111
沉迷学习2333
发表于 2018-8-15 14:16:04
homework1.c:18:16: error: expected ';' at end of declaration
FILE *fp
^
;
homework1.c:28:8: warning: implicit declaration of function 'While' is invalid
in C99 [-Wimplicit-function-declaration]
While ((temp = fgetc(fp)) != EOF)
^
homework1.c:28:41: error: expected ';' after expression
While ((temp = fgetc(fp)) != EOF)
^
;
homework1.c:43:19: error: expected ';' at end of declaration
int length
^
;
homework1.c:69:9: warning: implicit declaration of function 'chair' is invalid
in C99 [-Wimplicit-function-declaration]
chair(path)
^
homework1.c:69:20: error: expected ';' after expression
chair(path)
^
;
homework1.c:94:1: error: function definition is not allowed here
{
^
homework1.c:104:2: error: expected '}'
}
^
homework1.c:58:1: note: to match this '{'
{
^
2 warnings and 6 errors generated.
不知道错哪里了。。。。
沉迷学习2333
发表于 2018-8-15 14:45:08
沉迷学习2333 发表于 2018-8-15 14:16
homework1.c:18:16: error: expected ';' at end of declaration
FILE *fp
^
改完了。。但是用的时候还有问题。。
755697967
发表于 2018-8-15 15:02:10
我想看一下答案
沉迷学习2333
发表于 2018-8-15 15:58:38
沉迷学习2333 发表于 2018-8-15 14:45
改完了。。但是用的时候还有问题。。
linker command failed with exit code 1 (use -v to see invocation)..老显示这个。。救命啊鱼大仙
苛刻六日
发表于 2018-8-15 16:42:16
就看一眼
893721708
发表于 2018-8-15 16:59:29
那个统计代码函数的运行为啥显示“The Path . is wrong!”