只是新手007 发表于 2016-2-26 23:55:35

复习完毕- -

只是新手007 发表于 2016-2-27 01:00:34

我的是117行代码 重复检查3次没找到问题{:5_100:}

AiCpp 发表于 2016-2-27 02:06:28

不错不错,得多练习才是王道

hestephen 发表于 2016-2-27 15:24:30

beatss 发表于 2016-2-28 08:07:00

{:10_266:}{:10_266:}

bug猫 发表于 2016-2-28 19:42:17

我想看答案

westel 发表于 2016-2-29 20:46:36

0 计算机只认识0和1

1 cpu唯一认识的语言是机器码

2.C语言编写的源代码转换为汇编语言的过程叫编译

3.编译型语言是将全部程序编译后送机器运行。而解释型语言的本质是运行一条后再运行一条

4.Linux系统上用C语言编译的可执行程序,不能在windows上执行

5.通过编译器后,可以实现跨平台使用

6.摩尔斯电码(又译为摩斯密码,Morse code)是一种时通时断的信号代码,通过不同的排列顺序来表达不同的英文字母、数字和标点符号。它发明于1837年,发明者有争议,是美国人塞缪尔·莫尔斯或者艾尔菲德·维尔。 摩尔斯电码是一种早期的数字化通信形式,但是它不同于现代只使用零和一两种状态的二进制代码,它的代码包括五种: 点、划、点和划之间的停顿、每个字符间短的停顿(在点和划之间)、每个词之间中等的停顿以及句子之间长的停顿。

7.

动动手:

阿尔托莉雅 发表于 2016-3-1 01:58:52

搞不明白22那里怎么错了 都是一模一样的

testABC 发表于 2016-3-1 14:14:13

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


















癫疯孤独 发表于 2016-3-1 15:51:34

~写错八处, 真是写php写废了

墨烟 发表于 2016-3-1 16:18:35

待会回宿舍写代码哈哈 忘了T5的是怎么说的了泪目

碗碗的泡菜坛 发表于 2016-3-1 20:03:55

0.因为它只认识0和1
1.二进制
2.编码
3.炒菜和火锅
4.可以呀
5.不知道哎。。
6.编码和解码

墨烟 发表于 2016-3-1 23:24:59

报告~
Windows下的第86和92行应该是:findAllDirs(path); 吧?

还有我为嘛是0行{:10_266:}

李郝繁 发表于 2016-3-3 13:40:12

。。。。总是错误。。。{:10_266:}

maiyi 发表于 2016-3-3 14:08:21

0、叫它做什么就做什么
1、机器语言
2、编译
3、编译是编译成计算机可以读懂的可执行文件,解释是要运行时由解释器进行翻译,效率低
4、不可以,平台不同
5、由平同平台的解释器翻译同一语方即可,跨平台是解释器的工作不是程序员的工作。

yclchenlang 发表于 2016-3-3 22:05:17

RE: S1E2:第一个程序 | 课后测试题及答案

mqg315534065 发表于 2016-3-4 16:36:04

1

king哥 发表于 2016-3-4 18:46:59

6666666

腐烂小尸 发表于 2016-3-4 19:42:36

ee {:5_90:}

语言小白 发表于 2016-3-4 22:04:06

来瞅瞅!
页: 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16 17 18 19 20 21
查看完整版本: S1E2:第一个程序 | 课后测试题及答案