请教一个问题,哈哈~~~以为简单~~~却半天做不成~~看来我是笨

hyifeng 2003-06-01 10:28:56
int i1, i2, i3;
cin >> i1 >> i2 >> i3;
cout << i1 << ' ' << i2 << ' ' << i3;

应该怎样做,令我在控制台输入:
29,87,100
能正确输出:
29 87 100
...全文
29 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
晨星 2003-06-01
  • 打赏
  • 举报
回复
int i1, i2, i3;
char c;
cin >> i1 >> c >> i2 >> c >> i3;
cout << i1 << ' ' << i2 << ' ' << i3;
hyifeng 2003-06-01
  • 打赏
  • 举报
回复
snipersu,你的答案很好。
谢谢你指点拉。

但如果我要用cin实现,应该如何?
snipersu 2003-06-01
  • 打赏
  • 举报
回复
#include<iostream>
#include<cstdio>
using namespace std;
void main()
{
int i,j,k;
scanf("%d,%d,%d",&i,&j,&k);
cout<<i<<' '<<j<<' '<<k<<endl;
}
//OK 啦,虽然不好!
hyifeng 2003-06-01
  • 打赏
  • 举报
回复
coffeebike(咖啡色BIKE) 老兄,

你试过没有?
好像不行哇,
这样的出错哇
binary '>>' : no operator defined which takes a right-hand operand of type 'const char' (or there is no acceptable conversion)
coffeebike 2003-06-01
  • 打赏
  • 举报
回复
int i1, i2, i3;
cin >> i1 >> ',' >> i2 >> ',' >> i3;
cout << i1 << ' ' << i2 << ' ' << i3;

24,860

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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