鱼C论坛

 找回密码
 立即注册
楼主: 小甲鱼

[课后作业] S1E2:第一个程序 | 课后测试题及答案

    [复制链接]
发表于 2016-10-17 21:33:19 | 显示全部楼层
想看
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2016-10-18 21:31:21 | 显示全部楼层
好好学习,天天向上!
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-18 22:07:50 | 显示全部楼层
复制到vs2013中显示有错误
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-18 22:55:06 | 显示全部楼层
打了半天好像输错了,显示0行
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-18 22:58:45 | 显示全部楼层
怎么复制代码编译运行后显示27行代码?
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-19 13:14:33 | 显示全部楼层
支持!!
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2016-10-19 16:43:58 | 显示全部楼层
感谢分享,楼主辛苦了
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-19 20:18:38 | 显示全部楼层
查看参考答案
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-19 21:36:24 | 显示全部楼层
这答案期待啊
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-20 20:18:52 | 显示全部楼层
本帖最后由 fisccc 于 2016-10-20 20:27 编辑

Image 1.jpg
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-20 21:54:18 | 显示全部楼层
666
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2016-10-21 14:36:28 | 显示全部楼层
看测试题答案
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-21 14:51:13 | 显示全部楼层
总共99行代码。
修改了20分钟
写错了8个大小写字母;
丢了1个大括号;
拼错了1个单词;
遇到4个erro,
3个waring
最后终于没有错误的编译执行了
111.jpg
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-22 00:14:18 | 显示全部楼层

                               
登录/注册后可看大图
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-22 02:57:17 | 显示全部楼层
谢谢小甲鱼教导!
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-22 14:18:44 | 显示全部楼层
include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hello world!\n");
    return 0;
}
#include<io.h>
#include<direct.h>
#include<stdio.h>
#include<stdio.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 thePathe[MAX],target[MAX];

         strcpy(thePath,path);
         if((handle = _findfirst(strcat(thepath,"/*.c") &fa)) != -1L)
         {
                  do
                  {
                      sprintf(target, "%s/s%s",path,fa.name);
                      tatal +=countlines(target);
                  }whlie(_findnext(handle,&fa) ==o);
         }

          _findclose(handle);
}

void findALLDirs(const char *path)
{
        struct _finddata_t fa;
        long handle;
        char thePathe[MAX];

        strcpy(thePaht,paht);
        if((handle =_findfirst(strcat,"/*),&fa)) ==-1L)
        {
                 do
                 {
                     sprintf(target,"%s/%s",pathe,fa.mane);
                     total += countlines(target);
                 }while (findnext(handle,%fa) == o);
        }

        _findclose(handle);
}

void findALLDirs(const char *path)
{
    struct _finddata_t fa;
    long handle;
    char thePaht[MAX];

    strcpy(thePaht,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)
         {
                sprint(thePath,"%s/%s, path,fa.name);
                findALLCodes(thePath);
                findALLDirs(thePath);
         }
    }whlie (_findnext(handle,%fa) ==0);

    _findclose(handle);
}

int main()
}
        char path[MAX] = "."

        printf("计算中...\n");

        findAllCodes(path);
        findALLDirs(path);

        printf("目前你总共写了 %1d 行代码! \n\n",total);
        system("pause");

        return o;
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-23 11:57:52 From FishC Mobile | 显示全部楼层
看看 。。。。。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2016-10-23 12:00:38 | 显示全部楼层
0.只认识01
1.机器语言
2.编译
3.不知道
4.不知道
5.由解释器翻译成机器可认识的代码
6.不知道
7.不知道
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2016-10-23 20:45:50 | 显示全部楼层
1
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2016-10-25 21:34:49 | 显示全部楼层
真想知道
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-6-9 02:40

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表