给朕个机会 发表于 2022-3-7 09:58:21

1

ludexian 发表于 2022-3-7 11:18:21

答案

CLAixy 发表于 2022-3-7 12:38:49

我爱小甲鱼{:5_91:}

木槿it 发表于 2022-3-7 13:07:56

        感谢楼主无私奉献!

miefang 发表于 2022-3-7 13:53:09

为什么一直显示我MAX第一次使用,没有被定义啊。。。

875127250 发表于 2022-3-7 14:06:30

1

1634541267 发表于 2022-3-7 14:39:08

答案

摸鱼人 发表于 2022-3-7 15:09:00

1

Youlong 发表于 2022-3-7 16:16:57

1

2236247760 发表于 2022-3-7 16:22:57

{:5_102:}{:5_102:}{:5_102:}{:5_102:}

叶叶叶叶 发表于 2022-3-7 16:26:17

x

春风从不入睡 发表于 2022-3-7 17:21:09

查看

小鱼肝油 发表于 2022-3-7 17:26:22

0:计算机计算量很大但只能识别0,1
1:机器语言
2:编译
3:是否实现跨平台的这一功能
4:可以,因为c语言可移植性强
5:将源程序编写成字节码然后发送给解释器解释器再逐句翻译给cpu
6:将英文字母用莫斯密码来表示,不同的内容对应着它的莫斯密码
7:qinmen chend irenc
#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*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;
}

   

曾三百 发表于 2022-3-7 18:22:26

看看答案

bybuspiene 发表于 2022-3-7 20:28:52

Daan

11amazing11 发表于 2022-3-7 20:48:14

11

a1372245671 发表于 2022-3-7 20:59:18

{:5_90:}

Yuuta 发表于 2022-3-7 21:31:18

{:9_226:}

minsche 发表于 2022-3-7 22:13:12

giao

风雪半生 发表于 2022-3-7 22:29:20

真不错
页: 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 [1585] 1586 1587 1588 1589 1590 1591 1592 1593 1594
查看完整版本: S1E2:第一个程序 | 课后测试题及答案