C++,怎么把输入的字符和将要输出的内容排在一行?!

编程要求显示这样的结果

The area of the circle with radius 2 is 12.5664

半径2是从屏幕上输入的,调用函数来计算面积

cout<< "The area of a circle with the radius " ;
cin >> r;
cout<< " is " << area(r) <<endl;

但输出后就成了
The area of a circle with the radius 2
is 12.5664

怎么把它们在一行输出呢?就像题目要求那样?!

第1个回答  2009-05-23
用scanf来获取r就行了,顺序不用改!
第2个回答  2009-05-23
cin>>r;

cout<< "The area of a circle with the radius "<< r<< " is " << area(r) <<endl;本回答被提问者采纳
相似回答
大家正在搜