Planckkk 发表于 2022-3-23 15:51:19

可以

非非目 发表于 2022-3-23 15:55:20

学习学习

KYSA 发表于 2022-3-23 16:20:14

楼主,目录在哪里?

猫宁000 发表于 2022-3-23 16:36:29

查看参考答案

猫宁000 发表于 2022-3-23 17:09:40

查看参考答案

WLJCMXW 发表于 2022-3-23 17:10:03

第一个程序

a54627921 发表于 2022-3-23 17:28:42

11111111

xiao杰 发表于 2022-3-23 17:44:17

看答案有ld returned 1 exit status

楹楹楹楹蓝 发表于 2022-3-23 17:47:58

乱码惹。。

foruforme 发表于 2022-3-23 17:51:43

file:///C:/Users/%E6%92%92%E9%87%8E%E5%A5%94%E8%B7%91%E3%80%82/Desktop/$%7B$%60%7BV%25%60Z~9%5B~1T%60AAOH)4J.png

来自星星的小明 发表于 2022-3-23 18:08:12

0.0

sdatakey 发表于 2022-3-23 18:48:56

{:10_277:}

xiao黑 发表于 2022-3-23 19:12:06


#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;
}

湖光kosui 发表于 2022-3-23 22:11:14

本帖最后由 湖光kosui 于 2022-3-23 22:15 编辑

0 计算机只能读懂0和1
1 机器语言
2 编译
3 编译型语言可以,从高级语言转换为汇编语言再转换为机器语言,效率更高;
解释型语言只能转换为子杰码,之后由解释器翻译给计算机执行,效率较低。
Ps. 酒席和火锅的区别
4 能,也许要稍加改动。
5 通过解释器
6 通过查表,将字母和莫斯码对应。

Wemius 发表于 2022-3-23 23:55:44

朕想知道

谢谢谢谢 发表于 2022-3-24 08:37:20

.

391480123 发表于 2022-3-24 09:18:33

第一个程序 | 课后测试题及答案

84067682 发表于 2022-3-24 10:31:51

查看参考答案

Badboy$ 发表于 2022-3-24 12:40:15

11111

一霸时代 发表于 2022-3-24 14:09:05

回复
页: 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 [1599] 1600 1601 1602 1603 1604 1605 1606 1607 1608
查看完整版本: S1E2:第一个程序 | 课后测试题及答案