CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  C/C++ >  C语言

看看我这段代码错在哪儿呢?

楼主rorot(rorot)2003-09-01 23:54:33 在 C/C++ / C语言 提问

#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

相关问题

  • 这段代码哪儿有错?
  • 这段代码到底哪儿错了?
  • 请问这段代码错在哪儿?
  • 肯定有人会的---这段代码错在哪儿?
  • 请问这段代码哪儿错了,在线等候
  • 大家帮我看看这段代码,哪儿错了
  • 请看看这段代码哪儿出错?
  • 这段代码哪儿写错了,谁能告诉我
  • 请教:请问这段代码哪儿错了?
  • 请高手帮忙看一下这段代码哪儿错了

关键词

  • getchar
  • ch
  • isprint
  • implicit declaration
  • include
  • 加上
  • foos
  • void f00s
  • using namespace std
  • char

得分解答快速导航

  • 帖主:rorot
  • zhuixe
  • icansaymyabc
  • MiracleNo1

相关链接

  • C/C++ Blog
  • C/C++类图书
  • C/C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo