JUBEI 发表于 2017-10-30 14:37:35

查看答案

33挂会 发表于 2017-10-30 16:34:07

答案

shinexiaokui 发表于 2017-10-30 20:03:55

答案

同步人生 发表于 2017-10-30 20:22:50

看看和我的一样吗?

hmfcool 发表于 2017-10-31 12:35:24

我来看答案

Olaf霄 发表于 2017-10-31 12:39:00

好感动,打了很长时间

淡然一笑1128 发表于 2017-11-1 17:03:22

0.计算机只能识别机器语言
1.机器语言
2.编码
3.效率不同,c语言cpu可以直接执行;
4.可以
5.翻译器
6.编码与解码
7.

你是谁 发表于 2017-11-1 22:45:37

打卡

满城丶天香 发表于 2017-11-1 23:13:48

本帖最后由 满城丶天香 于 2017-11-1 23:16 编辑

莫斯密码是弄出来了,读不懂......是带有方言嘛?    好吧,是我不拼音不好...

无数君君 发表于 2017-11-2 22:00:41

打卡!!!!!!!!!!!

陆陆小凤 发表于 2017-11-2 23:10:07

写本上了

wujm 发表于 2017-11-3 15:17:14

123

wxr12310 发表于 2017-11-3 16:24:37

显示答案

一品带刀护卫 发表于 2017-11-3 23:16:58

答案

simengnianhua 发表于 2017-11-4 16:39:05

查看参考答案

simengnianhua 发表于 2017-11-4 16:40:07

查看参考答案

qq1724642151 发表于 2017-11-4 17:54:05

。。

flb123 发表于 2017-11-5 00:57:27

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

Zeon. 发表于 2017-11-5 12:30:41

我像查看本帖

z402375830 发表于 2017-11-5 15:04:05

什么
页: 85 86 87 88 89 90 91 92 93 94 [95] 96 97 98 99 100 101 102 103 104
查看完整版本: S1E2:第一个程序 | 课后测试题及答案