Chulainn 发表于 2019-3-7 08:51:40

回复回复

no.47 发表于 2019-3-7 09:49:40

测试题
0
因为计算机只认识0 1 这样的二进制机器码
1
机器语言
2
编译
3
编译型语言直接通过编译器编译成机器语言送给计算机
而解释型语言首先编译成中间代码 再通过解释器一句一句解释给计算机
4
阔以吧毕竟C语言可移植性强
5
通过中间代码送给不同的解释器吧我猜
6
莫斯密码的原理其实就是编码
7
I love FishC.com
dds
0
#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("目前你总共写了%d行代码!\n\n",total);
        system("pause");
       
        return 0;
       
}



lizig 发表于 2019-3-7 13:57:30

查看答案

一别两宽 发表于 2019-3-7 14:57:36

111

bebebeauty 发表于 2019-3-7 15:43:54

{:5_106:}

qq910152889 发表于 2019-3-7 16:48:14

0

爆裂模式 发表于 2019-3-7 21:24:46

看看啊

sunxun 发表于 2019-3-7 21:47:57

第一次作业

xiazhaoyang 发表于 2019-3-8 11:46:46

感谢小甲鱼的良苦用心,新人小白拜谢!

晓哥哥 发表于 2019-3-8 12:11:06

1111

847095356 发表于 2019-3-8 12:38:18

小甲鱼我爱你

冕广寒 发表于 2019-3-8 13:48:51

0.只会读取
1.机器码
2.C语言编程
3.解释型语言不会直接编译成机器码,要经过转换器
4.能
5.由字节码发到解释器
6.查找指令表
7.qinmen nnhend lrend hlfan shlf adong jlngd ag

lt941215 发表于 2019-3-8 16:04:02

zz

15112529059 发表于 2019-3-8 16:15:16

少时诵诗书

2260419554 发表于 2019-3-8 16:46:54

6666

aml2535 发表于 2019-3-8 19:36:31

一脸懵

Frankieyang 发表于 2019-3-8 21:15:12

{:5_109:}

夜宵 发表于 2019-3-8 21:58:39

计算中...
目前你总共写了0行代码!

生而耀眼 发表于 2019-3-8 22:15:48

生而耀眼 发表于 2019-3-8 22:16:23

页: 254 255 256 257 258 259 260 261 262 263 [264] 265 266 267 268 269 270 271 272 273
查看完整版本: S1E2:第一个程序 | 课后测试题及答案