gyl411745 发表于 2018-5-18 02:56:41

http://bbs.fishc.com/static/image/common/emp.gif

bod 发表于 2018-5-18 19:37:31

c

a799286112 发表于 2018-5-18 23:32:53

核对答案

爱因斯坦程序员 发表于 2018-5-19 10:24:12

甲鱼大大 我用的VS好像不行啊!老是提示要加_s加了又说什么不允许两个主体{:10_266:}{:10_266:}

miao1996 发表于 2018-5-20 12:25:35

666

乔宽 发表于 2018-5-21 18:13:21

回复

piaoxingjie3 发表于 2018-5-21 20:28:59

答案

开车蜗牛 发表于 2018-5-22 20:38:42

.

那条河 发表于 2018-5-22 22:44:14

好腻害

sswy 发表于 2018-5-22 23:23:32

{:5_91:}

tend 发表于 2018-5-23 14:19:36


#include <stdio.h>
#include <direct.h>
#include <stido.h>
#include <stdlib.h>
#include <string.h>

#define MAX   256

long total;

int countLines(const char *filename);
void findAllCodes(sonst 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 = ".";
   
    print(计算中...\n");
   
    findAllCodes(path);
    findAllDirs(path);
   
    printf("目前你共写了 %ld 行代码! \n\n",total);
    system("pause");
   
    return 0;
}

yuyou517 发表于 2018-5-23 20:18:57

good

lvple 发表于 2018-5-24 09:42:58

答案

马鹿是笨蛋 发表于 2018-5-24 18:11:32

本帖最后由 马鹿是笨蛋 于 2018-5-24 18:57 编辑

一个符号问题 找的头晕不一样啊 什么情况

乔宽 发表于 2018-5-24 18:27:38

0:因为计算计的“大脑是CPU,CPU负责计算机大部分的计算功能,而CPU原理上只认识0和1.
1:机器语言
2:编译
3:对于CPU而言,编译型语言是将源代码先通过编译器编译为CPU认识机器码,此后CPU随时都可以直间执行编译后的机器码;而解释型语言则不能直间编译成机器码,而是将源代码转成中间代码,然后发送给解释器,有解释器逐句翻译给CPU来执行。
4:不能。因为可执行文件在执行之前,操作系统要有一些准备工作,因为不同的操作系统,准备工作是不同的。
5:解释性语言——windows-——windows
                  ——Linux——linux
                  ------Macos——Macos
6:查表
7:亲们在敌人吃饭时发动进攻

mkdlf 发表于 2018-5-25 00:04:20

练习

累丶点 发表于 2018-5-25 10:59:16

em

0verl0 发表于 2018-5-25 13:58:24

查看参考答案

lyc458216 发表于 2018-5-25 14:37:02

朕想知道

BlackPilot 发表于 2018-5-25 18:08:28

刚刚开始学,还是只能看下答案来对比了{:5_99:}
页: 128 129 130 131 132 133 134 135 136 137 [138] 139 140 141 142 143 144 145 146 147
查看完整版本: S1E2:第一个程序 | 课后测试题及答案