fcmldjt12138 发表于 2021-8-3 09:51:11

0:只懂二进制的0和1
1:c语言
2:编译
3:编译语言计算机可以直接读懂,而解释型语言需要通过解释器解释
4:是
5:C语言
6:查表
7:亲们,趁敌人吃饭时发动进攻

HHYJ 发表于 2021-8-3 10:05:30

0.0

zhaidong 发表于 2021-8-3 10:24:24

感谢楼主无私奉献!

songhong 发表于 2021-8-3 10:39:58

1

大漠孤烟1109 发表于 2021-8-3 10:44:26

看答案

Amadeus岚 发表于 2021-8-3 10:47:03

1

Yannis1007 发表于 2021-8-3 11:10:35

好难啊

kuriiper 发表于 2021-8-3 11:24:28

第一课,希望自己能坚持下去

Roninor 发表于 2021-8-3 11:54:12

0

清水由樹 发表于 2021-8-3 12:03:15

{:5_90:}

Regina0 发表于 2021-8-3 12:41:07

0

大脑空白 发表于 2021-8-3 13:16:35

1

小于不卷 发表于 2021-8-3 13:33:25


#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;
}

纪月# 发表于 2021-8-3 13:46:13

抱歉啦

小于不卷 发表于 2021-8-3 13:50:37

我运行以后显示只有13行我不知道为什么{:10_266:}

yyushyui 发表于 2021-8-3 13:51:04

0.计算机只看得懂二进制
1.机器语言
2.编译
3.编译语言是转化为汇编语言再到机器语言解释语言是转化为字节码再由解释器翻译给计算机
4.不行
5.转化为字节码再由解释器翻译给计算机
6.长短音代表线和点,不同的点线组合代表不同的字母,用字母拼凑出语言信息

YSKey 发表于 2021-8-3 14:03:21

本帖最后由 YSKey 于 2021-8-3 14:06 编辑

211行代码

印第安斑鸠蛋 发表于 2021-8-3 14:45:39

看看对不对

2605917192 发表于 2021-8-3 15:11:15

111

Zurichsee 发表于 2021-8-3 15:16:12

运行错误
页: 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 [1292] 1293 1294 1295 1296 1297 1298 1299 1300 1301
查看完整版本: S1E2:第一个程序 | 课后测试题及答案