DaDa
28-12-2005, 16:52
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.4.2 [FreeBSD] 20040728
есть такая вот программка:
#include <iostream.h>
#include <ctype.h>
using namespace std;
int main()
{
int ch, lineno=0, charno=0, wordno=0;
for (int last=0; cin && (ch = cin.get()) != EOF; last=ch)
switch (ch)
{
case '\n': lineno++; wordno++;
break;
case '/': if (cin.peek()=='/') {
cin.ignore(10000,'\n');
lineno++;
}
else charno++;
break;
default: charno++;
if (isspase(ch) && last!=ch) wordno++;
}
cout << charno << " " << wordno << " " << lineno << "\n" << flush;
return 0;
}
при её компиляции
# g++ -Wno-deprecated -o mywc mywc.c
выдаётся вот такая ошибка:
mywc.c: In function `int main()':
mywc.c:20: error: `isspase' undeclared (first use this function)
mywc.c:20: error: (Each undeclared identifier is reported only once for each function it appears in.)
хотя
# locate ctype.h
/usr/include/_ctype.h
/usr/include/ctype.h
/usr/include/sys/ctype.h
/usr/include/wctype.h
/usr/ports/shells/v7sh/files/patch-ctype.h
/usr/src/sys/sys/ctype.h
Не подскажите в чем может быть проблема?
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.4.2 [FreeBSD] 20040728
есть такая вот программка:
#include <iostream.h>
#include <ctype.h>
using namespace std;
int main()
{
int ch, lineno=0, charno=0, wordno=0;
for (int last=0; cin && (ch = cin.get()) != EOF; last=ch)
switch (ch)
{
case '\n': lineno++; wordno++;
break;
case '/': if (cin.peek()=='/') {
cin.ignore(10000,'\n');
lineno++;
}
else charno++;
break;
default: charno++;
if (isspase(ch) && last!=ch) wordno++;
}
cout << charno << " " << wordno << " " << lineno << "\n" << flush;
return 0;
}
при её компиляции
# g++ -Wno-deprecated -o mywc mywc.c
выдаётся вот такая ошибка:
mywc.c: In function `int main()':
mywc.c:20: error: `isspase' undeclared (first use this function)
mywc.c:20: error: (Each undeclared identifier is reported only once for each function it appears in.)
хотя
# locate ctype.h
/usr/include/_ctype.h
/usr/include/ctype.h
/usr/include/sys/ctype.h
/usr/include/wctype.h
/usr/ports/shells/v7sh/files/patch-ctype.h
/usr/src/sys/sys/ctype.h
Не подскажите в чем может быть проблема?