好歹我也是个 发表于 2019-9-2 19:32:17

ok

海明 发表于 2019-9-2 20:29:30

学习

cassiopeia. 发表于 2019-9-2 20:38:01

谢谢

新手12138 发表于 2019-9-2 20:40:36

回复查看答案

甜姜姜 发表于 2019-9-2 20:40:45

0,只能识别0和1
1,机器语言
2编译
3,不能直接编译
4可以
5解释器
6查表

游龙当归海 发表于 2019-9-2 20:46:29

电脑只会0和1
机器语言
编译

不一定

主要靠编译表,一一对应就ok

大韩韩 发表于 2019-9-2 21:00:30

朕想知道

是菠萝不是萝卜 发表于 2019-9-2 21:47:08

壮大我c语言

最开始的选择 发表于 2019-9-2 23:13:14

对答案

1480589612 发表于 2019-9-2 23:49:52

jkj

Fowindy 发表于 2019-9-3 09:31:52

1

咸鱼也可翻身 发表于 2019-9-3 10:34:47

因为它没有思想

北海阿伯 发表于 2019-9-3 11:29:00

666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666

oldboy 发表于 2019-9-3 13:00:14

I love FishC.com!

LV_Violet 发表于 2019-9-3 13:51:29

顶顶顶顶

ky2y002 发表于 2019-9-3 14:19:13

计算机只认识0和1
机器语言二进制0和1
编译
编译型是将源代码编译为机器语言直接运行
解释型是先转化为中间语言再由解释器转化为机器语言
不可以
通过解释器
编码和解码
亲们趁敌人吃饭时发动进攻

b_74 发表于 2019-9-3 14:41:16

:上课
:起立
:老师好,
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
:好的,同学们今天这节课就到这里
:起立
:小甲鱼老师辛苦了

b_74 发表于 2019-9-3 14:48:23

本帖最后由 b_74 于 2019-9-3 14:52 编辑

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

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

int isCode(const char *filename);
{
        int length;

        length = strlen(filename);

        if (!strcmp(filename + (length - 2), ".c"))
        {
                return 1;
        }
        else
        {
                return 0;
        }
}

void findAllDirs(const char *path)
{
        DIR *dp;
        struct dirent *entry;
        struct stat statbuf;

        if ((dp = opendir(path)) == NULL)
        {
                fprintf(stderr, "The path %s is wrong!\n",path);
                return;
        }

        chdir(path);
        while ((entry = readdir(dp)) != NULL)
        {
                lstat(entry->d_name, &statbuf);

                if (!strcmp(".", entry->d_name) || !strcmp("..",entry->d_name))
                  continue;

                if (S_ISDIR(statbuf.st_mode))
                {
                        findAllDirs(entry->d_name);
                }
                else
                {
                        if (isCode(entry->d_name));
                        {
                                total += countLines(entry->d_name);
                        }
                }
                }

        chdir("..");
        closedir(dp);
}

int main()
{
        char path = ".";

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

        findAllDirs(path);

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

        return 0;
}


提示42行第1个字符错误

root@wang-virtual-machine:/home/myfiles# gcc s1e2.c -o s1e2.exe
s1e2.c:42:1: error: expected identifier or ‘(’ before ‘{’ token
{
^

请小甲鱼老师百忙之中不吝赐教,谢谢

环境是Ubuntu 18.04.02
Vim版本8.0
gcc版本7.4

素留缘 发表于 2019-9-3 14:50:35

请叫我遥少 发表于 2019-9-3 15:06:37

看看看看
页: 376 377 378 379 380 381 382 383 384 385 [386] 387 388 389 390 391 392 393 394 395
查看完整版本: S1E2:第一个程序 | 课后测试题及答案