wwwasd49 发表于 2022-7-21 11:03:08

1

Air.e 发表于 2022-7-21 11:06:38

1

18349807276 发表于 2022-7-21 11:12:43

109行

SunZF 发表于 2022-7-21 11:47:32

666

棉花糖ya 发表于 2022-7-21 14:54:10

已完成

棉花糖ya 发表于 2022-7-21 15:01:09

棉花糖ya 发表于 2022-7-21 14:54
已完成

为啥我抄的编码怎么改都是显示总共写了0行代码{:10_266:}

Aajht 发表于 2022-7-21 15:52:55

0.计算机只能识别机器语言0和1,不能识别高级语言(C语言等)
1.机器语言
2.编译
3.编译型语言没有字节码的解释而解释型语言由字节码经过解释器解释进而被CPU执行
4.可以
5.
6.有密码表可查对应的字母
7.亲们,趁敌人吃饭时发动进攻

kachii 发表于 2022-7-21 16:27:45

expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
{

月生复驲 发表于 2022-7-21 16:42:08

不错

mu_yang11 发表于 2022-7-21 16:47:02

看答案

夜长初鼓钟迟迟 发表于 2022-7-21 17:09:55

11

whoUR 发表于 2022-7-21 17:39:33

1

cyuyan999 发表于 2022-7-21 19:28:43

1

霃鏵 发表于 2022-7-21 20:10:09

感谢无私奉献

清佳 发表于 2022-7-21 21:33:49


#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 findAllCodes(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 %sis 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;
}

hrc666 发表于 2022-7-21 21:52:01

1

shuai0909 发表于 2022-7-21 22:06:01

1

苟始Wh 发表于 2022-7-21 22:26:10

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

欣欣电灯 发表于 2022-7-22 00:54:28

xx小甲鱼分享

stalingalaxy 发表于 2022-7-22 02:42:12

{:5_90:}
页: 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 [1681] 1682 1683 1684 1685 1686 1687 1688 1689 1690
查看完整版本: S1E2:第一个程序 | 课后测试题及答案