看看我这段代码错在哪儿呢?
#include<iostream>
#include<fstream>
using namespace std;
void F00S()
{
char ch;
while(ch=getchar()!='Q')
{ if(isprint(ch))
putchar(ch);
else
printf("cannot print\n");
}
}
int main()
{
FOOS();
return 0;
}
问题点数:20、回复次数:8Top
1 楼xinhe007(星河)回复于 2003-09-02 00:01:01 得分 0
有什么错误提示?Top
2 楼zhuixe(竹子)回复于 2003-09-02 00:02:44 得分 5
void F00S() //这里好像不是o的大写,而是0(零)
{
char ch;
while(ch=getchar()!='Q')
{ if(isprint(ch))
改成
void FOOS()
{
char ch;
while((ch=getchar())!='Q')
{ if(isprint(ch))
Top
3 楼LifeAndC(蓝色忧郁)回复于 2003-09-02 01:40:35 得分 0
while(ch=getchar()!='Q')
这儿的优先级对不对?Top
4 楼kuangjingbo(正在学习windows)回复于 2003-09-02 08:49:12 得分 0
while((ch=getchar())!='Q')
Top
5 楼rorot(rorot)回复于 2003-09-02 12:51:20 得分 0
这些是出错提示:我想不出为什么?
----------------------------------
[Warning] In function `void F00S()':
8
implicit declaration of function `int getchar(...)'
9
implicit declaration of function `int isprint(...)'
10
implicit declaration of function `int putchar(...)'
12
implicit declaration of function `int printf(...)'
[Warning] In function `int main()':
18
implicit declaration of function `int FOOS(...)'
Top
6 楼icansaymyabc(学习与进步)回复于 2003-09-02 13:10:18 得分 5
#include<iostream>
#include<fstream>
using namespace std;
去掉。
加上
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
Top
7 楼icansaymyabc(学习与进步)回复于 2003-09-02 13:11:16 得分 0
#include<iostream>
#include<fstream>
using namespace std;
去掉。
加上
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
Top
8 楼MiracleNo1(月冷风清)回复于 2003-09-02 13:13:01 得分 10
char ch;
while(ch=getchar()!='Q')
这里的ch声明为int型的,不应是char型的,因为有些字符放不下,具体看<<C缺陷与陷井>>,还有就是楼上的朋友说的优先级的问题,加个括号总是没有错误的,利大于弊.Top
9 楼reason1(reason1)回复于 2003-09-02 13:55:22 得分 0
#include<iostream>
#include<fstream>
是不是要加上.h?
#include<iostream.h>
#include<fstream.h>
Top




