whifish 发表于 2021-10-1 20:25:56

答案

神隐无双 发表于 2021-10-1 21:04:47

??

我要起床了 发表于 2021-10-1 21:10:55

fief

pillar方 发表于 2021-10-1 21:11:05

ok

qiumingxin 发表于 2021-10-1 21:15:02

答案

又菜又想C 发表于 2021-10-1 21:45:54

ok

T棉棉 发表于 2021-10-1 22:27:54

是真的回复了就能看吗

Swilder. 发表于 2021-10-1 23:11:12

。。

ivyc 发表于 2021-10-1 23:31:37

0只会二进制
1二进制语言
2···
3··
4不能
5···
6···
7···

已注册 发表于 2021-10-1 23:41:08

#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 fingALLFiles(const char*path);
int ciuntLines(const char*filename)
{
    FILE*fp;
    int count=0;
    int temp;
    if ((fp=fopen(filename,"r"))==NULL)
    {
      fprintf(stderr,"Can not openthe 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(theaPath,path);
    if((handle=_findfirst(strcat(thePath,"/*),&fa))==-1L)
{
fprintf(stderr,"The path %s iswrong!\n",path);
return;
}

do
{
if(!stcmp(fa.name,".")|| !strcmp(fa.name,".."))
contiue;

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("psuse);
    return 0;
}

已注册 发表于 2021-10-1 23:43:45

好像是没有include<io.h>这个头文件运行不了

1479908794 发表于 2021-10-2 00:51:52

冲冲冲

烟雨挽清秋 发表于 2021-10-2 03:43:20

我已完成

韵颧 发表于 2021-10-2 10:03:16

n

小龟不相信眼泪 发表于 2021-10-2 10:04:52

66

沉默中的程序猿 发表于 2021-10-2 10:16:28

本帖最后由 沉默中的程序猿 于 2021-10-2 10:20 编辑

1:因为计算机的CPU如人体的大脑只能读懂机器码(所谓的二进制语言)
2:机器码
4:解释性语言可以跨平太执行
5:也可以
6:源代码转换成字解码由解释器把字节码翻译成CPU读懂的语言
7:按照莫斯密码表把有规律的语言翻译成可供人阅读的语言

丿Demon 发表于 2021-10-2 10:17:59

{:5_105:}

linomcello 发表于 2021-10-2 10:25:19

子文件

vlanf 发表于 2021-10-2 10:27:58

{:10_284:}抄代码也这么困难,看着一模一样,编译全是错误

YUKI.T 发表于 2021-10-2 10:33:31

0.因为它听不懂人话
1.编程语言
7.用特殊符号代替字母
页: 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 [1397] 1398 1399 1400 1401 1402 1403 1404 1405 1406
查看完整版本: S1E2:第一个程序 | 课后测试题及答案