目前你总共写了211行代码!
计算机只认识0和1 两个数字,唯一认识机器语言。
计算中...
目前你总共写了143行代码!
请按任意键继续. . .
down
macOS系统使用Xcode编程代码,显示
the path scm.plist is wrong!
the path OpenQuickly-ReferencedFrameworks.index-v1 is wrong!
the path Logs is wrong!
the path TextIndex is wrong!
the path Index is wrong!
the path Build is wrong!
the path info.plist is wrong!
the path Intermediates.noindex is wrong!
the path Products is wrong!
the path Debug is wrong!
the path Xcode C is wrong!
目前你总共写了0行代码!
Program ended with exit code: 0
(其中the path *** is wrong!有很多行,这是其中一小部分)
验证正误
I love FishC.com
6
#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;
}
看答案
啊,这
1
看答案
1
111
1
1
学习第一天
答案
0 二进制 1机器语言 2编码 3 一个是一次性全编译 一个是一条条翻译 4 可以 5 6 编码解码7