坟头草` 发表于 2022-3-17 21:26:15

1111111

ADreams 发表于 2022-3-17 23:01:56

daan

AreyoureallyoK 发表于 2022-3-17 23:25:30

啊哈

周火火 发表于 2022-3-17 23:45:58

觉醒的卡喵 发表于 2022-3-17 23:57:25

1

xiaoxianxudu 发表于 2022-3-18 00:38:29

查看参考答案

jftt 发表于 2022-3-18 09:33:56

朕想知道

yaovilo 发表于 2022-3-18 10:41:11

看看答案~~~~

15281180631 发表于 2022-3-18 10:49:03

楼主辛苦了,感谢分享

zbc123 发表于 2022-3-18 11:50:25

haohaohoa

hee123 发表于 2022-3-18 12:35:38

c

还没睡醒诶 发表于 2022-3-18 13:56:37

罗三炮 发表于 2022-3-18 14:58:22

0

elise777 发表于 2022-3-18 15:28:48

入门第一天

掌上萌虎520 发表于 2022-3-18 16:18:24

谢谢鱼哥!

霓裳 发表于 2022-3-18 16:38:36

1

凌风or 发表于 2022-3-18 19:55:22

0.因为他只懂得0和1
1.cpu只懂得二进制的0和1
2.编译
3.编译型语言是把整体都做好出后输出
而解释型语言则是一个一个的输出
4.可以
5.需要配置好所需的坏境
6.查表
7.亲们趁敌人吃饭时发动进攻

动动手

yangshuhuai 发表于 2022-3-18 22:59:02

11

sho 发表于 2022-3-19 00:40:57

计算机只能识别二进制

小张是鱼油 发表于 2022-3-19 00:46:43


#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;
}
页: 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 [1593] 1594 1595 1596 1597 1598 1599 1600 1601 1602
查看完整版本: S1E2:第一个程序 | 课后测试题及答案