上好佳= 发表于 2021-1-13 23:24:39

答案

Zachary1321 发表于 2021-1-13 23:31:54

Compilation Failed


/usercode/file.cpp:2:10: fatal error: io.h: No such file or directory
    2 | #include <io.h>
      |          ^~~~~~
compilation terminated.

乐兮 发表于 2021-1-13 23:53:48

察看答案

黑粥 发表于 2021-1-13 23:57:15

答案

老虎是个莘莘 发表于 2021-1-14 01:18:33

新人

Zhiyuan源 发表于 2021-1-14 09:55:47

查看答案

老街 发表于 2021-1-14 10:48:08

感谢奉献

dhhhj 发表于 2021-1-14 11:14:23

0.        只认识0和1
1.        机器语言
2.        编译
3.        编译型先全部编译后执行,解释型逐句编译执行
4.        百分之八十可能
5.        编译成字节码,字节码再统一编译成机器码
6.        查表
7.        亲们,趁敌人吃,发动进攻!
计算中...
目前你总共写了 0 行代码!

请按任意键继续. . .

c305239681 发表于 2021-1-14 11:33:01

1.        CPU唯一认识的语言是什么语言?
答:机器语言
2.        C语言的源代码转换为汇编语言的过程叫什么?
答:编译
3.        编译型语言和解释型语言的本质区别是什么?
右边的效率更低一点,左边灵活度高,效率高,可移植性高。
4.        在Linux系统上用C语言编译的程序,是否能在Windows系统上执行?
可以。
5.        解释类型编程语言是如何实现跨平台的?
把java转成字节码,然后由解释器逐句翻译给cpu来执行。
6.        莫斯密码的原理其实是什么?
查表

i我不上火 发表于 2021-1-14 14:36:47

亲们趁敌人吃饭时发起进攻

大雨石 发表于 2021-1-14 14:40:13

快乐学习每一天

正太Hibiya君 发表于 2021-1-14 14:49:13


塔普top 发表于 2021-1-14 15:20:17

{:5_105:}

雷善瑞 发表于 2021-1-14 15:20:41

好开心

雷善瑞 发表于 2021-1-14 15:24:38

为什么我显示2000多行

祖国的向日葵 发表于 2021-1-14 15:52:20

1

fabulouskkk 发表于 2021-1-14 15:54:23

.

sukewolaopo 发表于 2021-1-14 16:11:03


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

viod findAIICodes(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);
                         findAIICodes(thePath);
                         findALLDirs(thePath);
               }
        }while (_findnext(handle, &fa) == 0);
       
        _findclose(handle);
}

int main()
{
       char path = ".";
       
       printf("计算中...\n");
       
       findAIICodes(path);
       findALLDirs(path);
       
       printf( "目前你总共写了 %Id 行代码!\n\n",total);
       system("pause");
       
       return 0;
}
       
}

wlpupup 发表于 2021-1-14 17:03:23

感谢博主无私奉献

sao7 发表于 2021-1-14 17:04:24

感谢fishCCC!!!!
页: 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 [1011] 1012 1013 1014 1015 1016 1017 1018 1019 1020
查看完整版本: S1E2:第一个程序 | 课后测试题及答案