916746244 发表于 2022-4-15 14:13:15

h

大大大脸猫 发表于 2022-4-15 15:34:12

出现3各未定义的引用

白木Yolo 发表于 2022-4-15 15:37:01

q

musare 发表于 2022-4-15 17:15:06

目前共写了8372行代码

delvishd 发表于 2022-4-15 18:12:11

0.计算机只能读懂0 和1
1.机器语言
2.编译
3.编译性语言是编译出一个程序,而解释型语言是需要转换成字节码,然后再翻译成机器能读懂的语言
4.可以,进行部分修改或者不修改都行
5.通过形成字节码,然后在目的平台上进行编译然后运行就行
6.原理是查表
7.吃饭

15110374882 发表于 2022-4-15 19:27:08

已完成学习

WATERFUI 发表于 2022-4-15 21:28:44

小甲鱼开心哦

wd7332661 发表于 2022-4-15 22:18:16

666

温柔淑女的于谦 发表于 2022-4-15 22:18:19

感觉很棒

侧耳倾听vivid 发表于 2022-4-15 22:48:38

1

山小 发表于 2022-4-16 11:44:41

动手 bbs.fishc.com

1821300713 发表于 2022-4-16 13:51:28

1

lisec 发表于 2022-4-16 14:46:56

我想看答案

星小空 发表于 2022-4-16 14:51:38

{:5_102:}

Eternal·Child 发表于 2022-4-16 15:08:55


#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("目前你总共写了%1d行代码!\n\n",total);
       system("pause");
       
       return 0;
}

modric9248 发表于 2022-4-16 15:28:42

{:5_109:}

ftao2019 发表于 2022-4-16 16:10:58

shoudao

源一 发表于 2022-4-16 16:26:31

666

qowxn910x 发表于 2022-4-16 16:34:15

热热

斌斌有你! 发表于 2022-4-16 16:51:11

0
页: 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 [1618] 1619 1620 1621 1622 1623 1624 1625 1626 1627
查看完整版本: S1E2:第一个程序 | 课后测试题及答案