通过cin>>如何给string的变量进行赋值

storm_lee 2003-08-20 03:37:43
#include<iostream>
#include<string>
using namespace std;
void main()
{
string s;
cin>>s;
}
编译没有通过,请告诉我怎么办?
...全文
455 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyp77 2003-08-20
  • 打赏
  • 举报
回复
应该是没有问题的
singleperson 2003-08-20
  • 打赏
  • 举报
回复
你用的是C#号
kmstart 2003-08-20
  • 打赏
  • 举报
回复
#include<iostream>
#include<string>
using namespace std;
void main()
{
string s;
cin>>s.getline();
}
nirvana_li 2003-08-20
  • 打赏
  • 举报
回复
这样的代码没有问题啊……
同志们都看不出来有什么问题啊……
应该可以通过编译,看看楼主用的是什么编译器了……
Andy84920 2003-08-20
  • 打赏
  • 举报
回复
是什么编译器啊?
jyfcsdn 2003-08-20
  • 打赏
  • 举报
回复
我在vc6.0中编译没有问题码
meimj 2003-08-20
  • 打赏
  • 举报
回复
错误提示是什么?
meimj 2003-08-20
  • 打赏
  • 举报
回复
我在vc6.0中试了一下没问题

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧