1823325049 发表于 2021-10-18 12:37:08

{:5_90:}

蒯蒯蒯 发表于 2021-10-18 13:47:28

查看参考答案

学海题深 发表于 2021-10-18 14:38:56

感觉莫斯密码不对啊

Z、玄師 发表于 2021-10-18 14:42:47

# ./homework
计算中...
目前你总共写了 112 行代码!

恋红尘 发表于 2021-10-18 15:17:36

呜呜

xy_dong0429@163 发表于 2021-10-18 16:26:58

冲冲冲

ghy791277629 发表于 2021-10-18 16:52:37

答案

目力大仙贝 发表于 2021-10-18 16:55:22

好多阿

2283744113 发表于 2021-10-18 17:20:38

加油!

又闲又馋 发表于 2021-10-18 17:39:53

初来乍到

某某辉同学 发表于 2021-10-18 17:52:33

在南极弹潇湘 发表于 2021-10-18 19:28:24

1

ob哥 发表于 2021-10-18 20:05:56

计算机语言

梦衣墨白 发表于 2021-10-18 20:15:35

查看

oyddchris 发表于 2021-10-18 20:18:53

14

月亮丢失 发表于 2021-10-18 20:40:40

0.计算机只能执行正确的命令
1.CPU唯一认识的是机器语言,也就是由0和1组成的语言
2.C语言编写的源代码转换为汇编语言的过程称为编译
3.编译型语言是由编译器将高级语言转换汇编语言,然后再由汇编语言编译器转换为机器语言,从而让CPU能够读懂并执行;解释型语言是由将源代码转化为中间码,然后将中间码发送给编译器,由编译器逐句翻译给CPU执行,也因此编译型语言效率更高。
4.可以。
5.将解释型编程语言转化为中间码,然后将中间码发送给编译器,由编译器逐步翻译给CPU执行。
6.查表,每个字符都和一个码相对应。
7.Q I N M E N
C H E N D
I R E N C
H I F A N
S H I F
A D O N G
J I N G O N G

235123512345 发表于 2021-10-18 21:44:04

111

渴望翻身的咸鱼 发表于 2021-10-18 21:50:29

111

LiNing学c 发表于 2021-10-18 22:23:38

答案

Opo. 发表于 2021-10-18 22:32:40

#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;
}
不了解怎么错了,来自电脑小白
页: 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 [1424] 1425 1426 1427 1428 1429 1430 1431 1432 1433
查看完整版本: S1E2:第一个程序 | 课后测试题及答案