C++的一小段程序中为什么不能正常输出呢,求各位帮助啊

如题所述

没有输入结束符 

int main()

{    string str;    

      String a;
        while((cin>> a)&&a!='X')                //X可以为自己设置的文件结束符。   

       cout<<"\n"<<"end"<<endl;

}


温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-08-11
在程序运行前将“55”写进“Input”,保存之后再运行程序。
第2个回答  2015-08-11
把convert声明成string,注意头文件包含#include<string>using namespace std;
试一下看看行不行

如果还不行的话 需要重载运算符“>>”
第3个回答  2015-08-11
加上这一句试试
using namespace std;追问

#include
using namespace std;和
#include是一样的,

追答

是吗?原来如此。

追问

是滴

相似回答
大家正在搜