鱼C论坛

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

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

    [复制链接]
发表于 2022-12-11 03:02:24 | 显示全部楼层
零基础入门学习C语言封面
《零基础入门学习C语言》
小甲鱼 著
立即购买
问答题答案:
66666


动动手答案:


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

使用道具 举报

发表于 2022-12-11 10:08:10 | 显示全部楼层
只能识别二进制0和1
机器语言
编译

通过编译器
不知道



动动手答案:

#include<stdio.h>
#include<unistd.h>
#include<dirent.h>
#include<string.h>
#include<stdlib.h>
#include<sys/stat.h>

#define MAX         256

long total;

int countLines(const char *filename);
int isCode(const char *filename);
void findAllDirs(const char *path);

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

使用道具 举报

发表于 2022-12-11 14:22:40 | 显示全部楼层
问答题答案:测试题答案



动动手答案:


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

使用道具 举报

发表于 2022-12-11 16:27:07 | 显示全部楼层
问答题答案:

回复

动动手答案:


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

使用道具 举报

发表于 2022-12-11 20:05:08 | 显示全部楼层
问答题答案:



动动手答案:


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

使用道具 举报

发表于 2022-12-11 21:05:41 | 显示全部楼层
问答题答案:



动动手答案:


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

使用道具 举报

发表于 2022-12-11 23:32:22 From FishC Mobile | 显示全部楼层
问答题答案:



动动手答案:


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

使用道具 举报

发表于 2022-12-11 23:54:44 | 显示全部楼层
问答题答案:

只认识二进制语言

动动手答案:


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

使用道具 举报

发表于 2022-12-12 00:01:42 | 显示全部楼层
问答题答案:
查看参考答案


动动手答案:
查看参考答案

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

使用道具 举报

发表于 2022-12-12 12:35:04 | 显示全部楼层
问答题答案:
0.因为计算机只能识别0和1
1.机器语言
2.编译
3.编译型语言在执行之前要经过编译器将源码执行成CPU可识别的机器码文件,解释型语言则是由解释器一行一行解释并执行
4.不可以
5.用虚拟机进行跨平台
6.数字对应单词
7.qinmenchndirenchifanshifadongjingong
动动手答案:

#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[MAX], target[MAX];
        
        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[MAX];
        
        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[MAX] = ".";
        
        printf("计算中...\n");
        
        findAllCodes(path);
        findALLDirs(path);
        
        printf("目前你总共写了 %ld 行代码!\n\n", total);
        system("pause");
        
        return 0;
}


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

使用道具 举报

发表于 2022-12-12 17:03:14 | 显示全部楼层
问答题答案:



动动手答案:

查看答案
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-12-12 17:40:00 | 显示全部楼层
问答题答案:



动动手答案:

#include<io.h>
#include<直接.h>
#include<stdio.h>
#include<stdlib.h>
#include<字符串.h>

#define 最大 256

长总计;

int countLines(const char *filename);
void findALLCodes(const char *path);
void findALLFiles(consr char *path);

int countLines(const char *Filename)
{
    文件 *fp;
    整数计数=0;
    整数温度;

    if  ((fp=fopen(文件名,"r"))=NULL)
    {
        fprintf(stderr,"无法打开文件:%s\n",文件名);
        返回0;
    }
    而((temp=fgetc(fp))!=EOF)
    {
        if(temp=='\n')
        {
            计数++;
        }
    }
    FCLOSE(FP);

    返回计数;
}

void findAllCodes(const char *path)
{
    结构_finddata_t FA;
    长手柄;
    char thePath[MAX],target[MAX];

    strcpy(thePath,path);
    if((handle=_findfirst(strcat(thePath,"/*.c"),&fa))!=-1L)
    {
        做
        {
            sprintf(target,"%s,%s",path,fa.name);
            总计+=计数行(目标);
        }while(_findnext(handle,%fa)==0);
    }
  
    _findclose(手柄);  
}

void findALLDirs(const char *path)
{
    结构_finddata_t FA;
    长手柄;
    char thePath[MAX];

    strcpy(thePath,path);
    if((handle=findfirst(strcat(thePath,"/*"),&fa))==-1L)
    {
        fprintf(stderr,"the path is wrong!\n",path);
        返回;
    }
    做
    {
        if(!strcmp(fa.name,".")||!strcmp(fa.name,".."))
        继续;

        if(fa.attrib==_A_SUBDIR)
        {
            sprintf(thePath,"%s%s",path,fa.name);
            查找所有代码(路径);
            findALLDirs(thePath);
        }
    }while(_findnext(handle,&fa)==0);

    _findclose(手柄);
}

int main()
{
    字符路径[MAX]=".";
    printf("计算中...\n");
    查找所有代码(路径);
    findALLDirs(path);
    printf("目前你总共写了%1d行代码!\n\n",total);
    系统("暂停");
    返回 0;
}
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2022-12-12 19:21:25 | 显示全部楼层
问答题答案:



动动手答案:


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

使用道具 举报

发表于 2022-12-13 09:04:46 | 显示全部楼层
问答题答案:好的



动动手答案:


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

使用道具 举报

发表于 2022-12-13 09:14:33 | 显示全部楼层
问答题答案:
0.计算机只能识别0和1
1.机器语言(机器码)
2.编码
3.有没有翻译器
4.不能
5.
6.
7.亲们趁敌人吃饭时发动



动动手答案:
114行代码

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

使用道具 举报

发表于 2022-12-13 09:29:39 | 显示全部楼层
问答题答案:

w

动动手答案:
w

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

使用道具 举报

发表于 2022-12-13 09:59:52 | 显示全部楼层
问答题答案:



动动手答案:


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

使用道具 举报

发表于 2022-12-13 10:15:49 | 显示全部楼层
问答题答案:


只识别01
机器语言
编译
跳转
可以
解释器
定义
动动手答案:


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

使用道具 举报

发表于 2022-12-13 10:34:50 | 显示全部楼层
问答题答案:不太会啊




动动手答案:


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

使用道具 举报

发表于 2022-12-13 11:34:15 | 显示全部楼层
问答题答案:


0.
动动手答案:


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-12 00:45

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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