您好,在我编译结束后在第38行出现了这样的问题
48 38 D:\c语言学习\第一节课\未命名3.cpp 'thePath' was not declared in this scope
我找了很久没有发现问题,望解答
对下答案
sss
qinmen
chend
irenc
hifan
shif
adong
jingo
ng
#include <io.h>
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
long total;
int countlines(const char *filename);
#include <string.h>
#define MAX 256
void findAllCodes(const char *path);
void finfALLFiles(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 += coutlines(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
很好很好
晚上好!
hello world
我要学习!
6
C:\Users\xql\Desktop\ccccc\p2\collect2.exe ld returned 1 exit status
一直是此报错哈哈哈。。用文本对比了下,找不出哪儿码错了
0因为只懂二进制0和1
1机器码也叫机器语言
2叫做编译
3编译型语言CUP可以直接读懂执行
解释型语言要通过解释器CUP才可以读懂执行
4不能把
5把源代码编写成中间码只有别的电脑有解释器就可以跨平台使用
6.查表
7.亲们趁着敌人吃饭时间发动进攻
求答案
..
kankan
look
菜鸟新手,想要习题答案