当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·问题求教,大虾支招,谢谢    »显示摘要«
    摘要: 功能说明: 程序由一个负责显示状态信息界面进程和一个负责链路检测的线程组成,检测结果是通过消息来通知界面更新的 以下是部分代码: 开启线程: ... hwnd hwnd = getsafehwnd(); afxbeginthread(linktestthreadproc, hwnd, thread_priority_normal, 0, 0, null); ... 链路检测线程(linkt......
 ·启动不了,c盘找不到怎么办    »显示摘要«
    摘要: 请问各位一个问题: 电脑在没有任何改动的情况下,突然不能启动,显示是找不到c盘了,在bios里能找到硬盘,但是就是不能启动。请问这怎么解决。请指教! ......


#include<iostream> 与#include<iostream.h> 的问题

 
  #include<iostream>     //不行,必须要加上.h    
  void   main()    
  {    
  cout<<"Right?"<<endl;    
  }    
   
  #include<string>    
  #include<iostream.h>     //不行,此处必须去掉.h    
  using   namespace   std   ;    
  void   main()    
  {    
  string   s;    
  getline(cin,s);    
  cout<<"Right?"<<endl;    
  }    
  两者有什么区别?为什么有的时候要加上.h   而有的时候不能加???  
   
   
 

NO.1   作者: freewing

关键在 using   namespace   std   ;

NO.2   作者: xfxfxf

iostream.h里面定义的所有类以及对象都是在全局空间里,所以你可以直接用cout  
  但在iostream里面,它所定义的东西都在名字空间std里面,所以你必须加上  
  using   namespace   std才能使用cout

NO.3   作者: angelmaoyang

看一下C++中的命名空间,因为STL库都是在std明明空间中实现的。  
  可以用std域修饰符限定:  
  #include   <iostream.h>  
  #include   <iostream>  
   
  void   main()  
  {  
        cout   <<   "hello"   <<   endl   ;       //   ok    
        std::cout   <<   "hello"   <<   std::endl   ;   //   should   be   ok    
  }

NO.4   作者: ljianq

#ifdef   _RW_STD_IOSTREAM  
  #include   <iostream>  
  #else  
  #include   <iostream.h>  
  #endif  
   
  #ifndef   _RWSTD_NO_NAMESPACE  
        using   namespace   std;  
  #endif


    摘要: oracle中有个表中id字段是根据自增序列xxx来自增的,如果写sql语句可以这样 select xxx.nextval as id from dual 但在ejb中怎么得到自增序列中的值?? 或有没有别的方法让该字段不重复的自增?? 解决即给分!!! ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE