yaoyaozhe 发表于 2016-1-8 11:19:16

终于做完作业了
开始有不少错误
C:\Users\aa\Desktop\QQ截图20160108110947.jpg
后来都改正了
C:\Users\aa\Desktop\QQ截图20160108111532.jpg

yaoyaozhe 发表于 2016-1-8 11:22:16

作业已完成,第一次回复的时候图片没有放上去,再回复一个

舞劲繁华 发表于 2016-1-8 18:11:52

奋斗中,,,,,,

【残々剑】 发表于 2016-1-8 22:40:56

我要不……有、不

The_twice 发表于 2016-1-9 15:08:30

Have a look{:10_255:}

2696772619 发表于 2016-1-10 18:37:05

0.因为计算机只识别机器语言

1.机器语言

2.编译

3.编译型语言直接运行,解释型语言要解释

4.能,因为linux和windows都是c写的

5.靠解释器跨平台

6.查表

7.qin men chen di ren chi fan sho fa dong jin gong
亲们趁敌人吃饭时候发动进攻

冥顽 发表于 2016-1-11 02:14:48

哎感觉还是菜鸟啊

lasjz 发表于 2016-1-11 15:35:55

1

辛雨之恋 发表于 2016-1-11 20:18:07

小甲鱼辛苦了。

a28999928 发表于 2016-1-12 00:30:07

DDDD

Scoundrel丶You 发表于 2016-1-13 21:45:53

QFGR
CHRD
IRRC
HJIP
SHIF
PJNG
JFGO
NG

zhusonglin 发表于 2016-1-15 12:04:53

啥情况这是.

464318257 发表于 2016-1-15 12:21:17

哈哈,刚开始打到了Mac的代码,随后修改会Windows的代码.感觉修改起来不容易呀

Scoundrel丶You 发表于 2016-1-15 13:09:42

编译不出来,不知道为什么

休止符 发表于 2016-1-16 15:41:31

0.因为计算机只会0和1两个字
1.汇编语言。。吧
2.

慕枫沐雨 发表于 2016-1-16 21:15:33

先看看

冰雪孤狼 发表于 2016-1-18 17:06:19


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

#define MAX256

long total;

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

int counstLines(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;
}

hsiamer 发表于 2016-1-18 17:51:40

{:5_92:}

yu359107767 发表于 2016-1-20 09:48:48

初学者自学中。。。。。。。。

Two 发表于 2016-1-20 11:07:55

看看答案,已经做完了~
页: 1 2 3 4 5 6 [7] 8 9 10 11 12 13 14 15 16
查看完整版本: S1E2:第一个程序 | 课后测试题及答案