会飞的东北人 发表于 2020-5-27 11:05:06

答案

歪歪仔 发表于 2020-5-27 11:08:55

Yangkk 发表于 2020-5-27 11:12:34

111212

kiskis 发表于 2020-5-27 11:33:32

1

奇怪的自闭患者 发表于 2020-5-27 12:09:52

1

吃饱没事干 发表于 2020-5-27 13:09:36

查看参考答案

呆瓜呆瓜大傻瓜 发表于 2020-5-27 13:18:58

kankan

wchen0316 发表于 2020-5-27 14:06:35

110

qxw19 发表于 2020-5-27 14:19:53

d1{:9_232:}

萌新爱学习 发表于 2020-5-27 16:10:55

0. 因为计算机是二进制的 只认识 0 1
1. C语言
2. 转译
3. 解释型语言不能再CPU上直接运行,需要解释器帮助
   编译型语言可以直接在CPU上执行
4. 可以 因为C语言 可移植性型高
5. 通过解释器
6. 通过规定的密码 来进行转译
7.

老色批了 发表于 2020-5-27 16:24:08

第一个程序答案

chuan. 发表于 2020-5-27 16:38:30

查看课后答案。

纵戈 发表于 2020-5-27 16:54:13


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

老飞行员了 发表于 2020-5-27 17:30:31

看看答案{:10_297:}

xuelong715 发表于 2020-5-27 17:32:28

看看,因为无电脑

_thisisNoro 发表于 2020-5-27 18:10:14

查看参考答案

lyx529552794 发表于 2020-5-27 18:26:45

谢谢大佬

1317640662 发表于 2020-5-27 18:35:25


tuzidalao 发表于 2020-5-27 18:45:03

感谢楼主无私奉献!

赵嘉琦 发表于 2020-5-27 19:28:01

1
页: 708 709 710 711 712 713 714 715 716 717 [718] 719 720 721 722 723 724 725 726 727
查看完整版本: S1E2:第一个程序 | 课后测试题及答案