BLACKPINKiyo 发表于 2020-11-24 13:16:31

滴滴滴

业精于勤0416 发表于 2020-11-24 15:08:49

45555555555555555555

w玩家 发表于 2020-11-24 15:25:54

ee

1874971845 发表于 2020-11-24 17:34:36

学习 冲冲冲

龖dada 发表于 2020-11-24 17:37:43

小鱼你好,我是新手,喜欢你的教程,期待我们能共同进步

2501967124 发表于 2020-11-24 19:06:42

{:5_109:}

怪蘇叔 发表于 2020-11-24 19:49:51

0.因为计算机只认识0和1。
1.机器语言。
2.编译。
3.编译型语言效率高,解释型语言效率较慢但可跨平台。
4.能,但有些要修改一下。
5.通过源码转换成字节码再通过解释器让cpu执行。
6.通过对比摩斯编码表翻译。
7.亲们趁敌人吃饭时发动进攻。

040231703 发表于 2020-11-24 19:52:16

1

km8 发表于 2020-11-24 20:05:54

q

Dr.Ren812 发表于 2020-11-24 20:33:48

.

臣醒stm32 发表于 2020-11-24 21:30:51

计算机只会按照所给指令

月薪两万的贝贝 发表于 2020-11-24 22:07:59

0.计算机只能识别0和1.
1.汇编语言
2.解码
3.编译型语言计算机能识别,解释型语言不直接编译成机器语言
4.不一定
5.通过解释器
6.编码,解码

SPACElion 发表于 2020-11-24 22:12:46

芝麻开门

许少杰 发表于 2020-11-24 22:22:46

第一课冲鸭

G.X.Y. 发表于 2020-11-24 22:52:33


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

网鱼鱼 发表于 2020-11-24 23:38:27

开始了

小c.... 发表于 2020-11-24 23:43:23

答案

18923914921 发表于 2020-11-24 23:44:22

运行不了

a591258 发表于 2020-11-25 00:12:39

签到

tangyhxue 发表于 2020-11-25 10:13:16


#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:%\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);
                        findAlCodes(thePath);
                        findALLDirs(thePath);
                       
                }
        }while(_findnext(handle,&fa)==0);
       
        _findclose(handle);
}

int main()
{
        char path=".";
       
        printf("计算中...\n");
       
        rindAllCodes(path);
        findALLDirs(path);
       
        printf("目前你总共写了%ld行代码!\n\n",total);
        system("pause");
       
        return 0;
}
页: 951 952 953 954 955 956 957 958 959 960 [961] 962 963 964 965 966 967 968 969 970
查看完整版本: S1E2:第一个程序 | 课后测试题及答案