看答案啦
fa未声明怎么办?
0. 因为计算机只认识0和1
1. 机器语言
2. 忘了哈哈哈
3. 忘了。。
4. 不能
5. 通过不同的。。编码器?
6. 二进制
7. 不知道
打卡签到
0:二进制。0101
1.机器语言
2.编译
3.效率不同
4.不可以
5.不直接编码,而是转换为字节码,每次运行都要解释。
6.摩斯密码的原理就是查表。
7.亲们趁敌人吃法发动进攻
本帖最后由 AlexanderLeolin 于 2018-8-13 19:20 编辑
0:二进制。0101
1.机器语言
2.编译
3.效率不同
4.不可以
5.不直接编码,而是转换为字节码,每次运行都要解释。
6.摩斯密码的原理就是查表。
7.亲们趁敌人吃饭发动进攻
我复制代码上去为什么还是有一个错误。
为啥计算出的是0行{:10_243:}
想了解答案
#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;
}
学习学习
小甲鱼牛逼
11111111111111
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:16
homework1.c:18:16: error: expected ';' at end of declaration
FILE *fp
^
改完了。。但是用的时候还有问题。。
我想看一下答案
沉迷学习2333 发表于 2018-8-15 14:45
改完了。。但是用的时候还有问题。。
linker command failed with exit code 1 (use -v to see invocation)..老显示这个。。救命啊鱼大仙
就看一眼
那个统计代码函数的运行为啥显示“The Path . is wrong!”
{:5_95:}