glm123456 发表于 2026-1-12 19:43:00

1

七元龙井茶 发表于 2026-1-13 21:51:13

琳Lin 发表于 2026-1-13 22:02:43

只能读懂0和1
机器语言
编译
可以
解释器
查表

dnfcj 发表于 2026-1-15 14:40:07

{:5_101:}

saylcxya 发表于 2026-1-15 15:02:39

bvn

芸芸众生ovvo 发表于 2026-1-15 16:32:39

5

liubulong 发表于 2026-1-15 17:21:49

66666666666

三水fi 发表于 2026-1-16 11:23:46

{:10_333:}

wzm331 发表于 2026-1-16 22:07:46

.

落落,,, 发表于 2026-1-17 09:33:15

#include <io.h>
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX256

long total;

int countLines(const char *filename);
void findAllCodes(const char *path);
void findAllDirs(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;

    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;

}

asn第一 发表于 2026-1-17 09:59:14

1

晚风起飞 发表于 2026-1-17 18:42:21

11

valleynone 发表于 2026-1-17 22:45:09

1

2019959504 发表于 2026-1-19 01:37:18

o

54pt 发表于 2026-1-19 10:03:09

.

太空308 发表于 2026-1-19 22:43:50

报道

wm616520 发表于 2026-1-20 14:41:03

laugh

AA3CWu 发表于 2026-1-20 16:14:01

加油!

风语河岸柳 发表于 2026-1-20 23:26:27

1

Waleego 发表于 2026-1-21 09:12:45

hello world
页: 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 [2130] 2131 2132 2133 2134 2135 2136 2137 2138 2139
查看完整版本: S1E2:第一个程序 | 课后测试题及答案