元气少女草莓熊 发表于 2023-4-11 14:21:19

0:只运算二进制数。1:汇编语言。2:编译。3:本质区别是编译型语言的步骤是源代码-编译-连接、解释性语言是源代码-编译,本质区别是没有连接这一步。4:可以。5:语言解释器。6:查表。7:qinmenchendirenchifanshifadongjingong

893345203 发表于 2023-4-11 14:38:06

1

CIS 发表于 2023-4-11 18:04:06

回复

Y528 发表于 2023-4-11 20:02:05

{:7_146:}

ceoeo 发表于 2023-4-11 21:07:53

C:\Users\ymg\Desktop

x1aozhao 发表于 2023-4-11 22:37:10

s1e1

Y4869 发表于 2023-4-11 22:54:00

想看

yangpro 发表于 2023-4-11 23:40:00

0

KI_ 发表于 2023-4-12 10:10:53

字母_数字 发表于 2023-4-12 10:19:51

答案

@luo 发表于 2023-4-12 10:47:44

1

488 发表于 2023-4-12 11:27:37

答案

ZKSen 发表于 2023-4-12 14:54:40

QIN MEN CHEN DI REN CHI FAN SHI FA DONG JING JIN GONG
亲们 趁敌人吃饭发动进攻

jobb 发表于 2023-4-12 22:08:20

答案

jobb 发表于 2023-4-12 22:09:38

查看参考答案

gxcrisis 发表于 2023-4-12 22:24:46

大气

blue00dream 发表于 2023-4-12 22:45:14

完成了完成了{:5_104:}

miyi.24 发表于 2023-4-13 13:49:01

。。。

常发着呆 发表于 2023-4-13 14:24:08

查看参考答案

亿万富翁老可爱 发表于 2023-4-13 16:26:29


#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;
}
页: 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 [1883] 1884 1885 1886 1887 1888 1889 1890 1891 1892
查看完整版本: S1E2:第一个程序 | 课后测试题及答案