2608564594 发表于 2023-1-27 14:37:56

1

咸鱼菌子 发表于 2023-1-27 14:52:57

109行代码

小陌yhl 发表于 2023-1-27 15:41:19

1

rmhs 发表于 2023-1-27 16:38:16

cool

Haober 发表于 2023-1-27 22:15:21

棒诶

chenruixuan 发表于 2023-1-27 22:35:42

nn

风铃山谷 发表于 2023-1-27 22:57:59

`

不染以柒 发表于 2023-1-28 09:47:44

0.计算机只能识别0和1的机器语言
1.机器语言
2.编译
3.面对过程和面对对象
4.可以
5.解释器
6.映射
7.亲们,趁敌人吃饭时发动进攻。

374279914 发表于 2023-1-28 09:49:18

66666

mgg呀 发表于 2023-1-28 11:27:30

1

爱学习的小方 发表于 2023-1-28 13:26:37

打卡

独步失格 发表于 2023-1-28 14:37:48

看答案

stayroom 发表于 2023-1-28 14:51:59

1

1960185363 发表于 2023-1-28 16:29:06

1

weixutrong 发表于 2023-1-28 18:30:21

他只能读懂机器语言
机器语言
编码
对解释执行而言,程序运行时的控制权在解释器而不在用户程序;对编译执行而言,运行时的控制权在用户程序。

查表
qinmenchendirenchifanfadongjingong

abc980947375 发表于 2023-1-28 22:19:04

1111111

Tjjjj 发表于 2023-1-29 09:22:06

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

BaldingCargo 发表于 2023-1-29 10:04:26

ASD

一颗冰激凌 发表于 2023-1-29 12:20:17

{:5_108:}

小蔡一碟 发表于 2023-1-29 13:03:33

#define _CRT_SECURE_NO_WARNINGS
#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("目前你总共写了 %ld 行代码!\n\n", total);
    system("pause");

    return 0;
}
页: 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 [1837] 1838 1839 1840 1841 1842 1843 1844 1845 1846
查看完整版本: S1E2:第一个程序 | 课后测试题及答案