0.因为计算机只能人说一步做一步,不会转弯
1.计算机语言
2.编译
3.编译型是全部转换成二进制,再运行;解释型是翻一句,执行一句
4.不能,不同系统不一样
5.
计算中...
目前你总共写了 0 行代码!
你好,我用的Macos,打出来怎么是“计算中...目前你总共写了 0 行代码!”,我查了代码没有问题,复制粘贴也是显示0行
1
蹲蹲答案
1
讲解的挺好的,问题已经自己答完,对比下看自己是否有记忆错误的地方
回复
是不是Visual Studio2019调用不了里面的函数?运行的时候一直报错说函数不安全。
终于好啦,QAQ
看看
1
做完啦
1
1
要学好编程,得很熟悉键盘
终于抄完了!
#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;
}
666666666666666666666
0
计算机只认识二进制的机器码
1
机器语言
2
编译
3
编译型先转换成二进制文件再执行
解释型需要由解释器逐行执行
4
不可以
5
..
6
以点线的组合表示字母
7
..