![]() |
#2
kspliusa2009-10-18 21:21
|

#include <iostream>
using namespace std;
int main()
{
const double pi=3.1415926535; //定义pi并赋初值
static double r,d,c,s;
char cm[3]={'e','x'};
do
{
cout<<"请输入圆的半径: "<<endl;
cin>>r;
d=2*r; //直径
c=pi*d; //周长
s=pi*r*r; //面积
cout<<endl<<"计算结果:";
cout<<endl<<"直径:\t"<<d;
cout<<endl<<"周长:\t"<<c;
cout<<endl<<"面积:\t"<<s<<endl;
cout<<endl<<"输入字符e或输入其他字符继续计算: ";
cin>>cm;
cout<<endl;
}
while (cm="ex");
return 0;
}
using namespace std;
int main()
{
const double pi=3.1415926535; //定义pi并赋初值
static double r,d,c,s;
char cm[3]={'e','x'};
do
{
cout<<"请输入圆的半径: "<<endl;
cin>>r;
d=2*r; //直径
c=pi*d; //周长
s=pi*r*r; //面积
cout<<endl<<"计算结果:";
cout<<endl<<"直径:\t"<<d;
cout<<endl<<"周长:\t"<<c;
cout<<endl<<"面积:\t"<<s<<endl;
cout<<endl<<"输入字符e或输入其他字符继续计算: ";
cin>>cm;
cout<<endl;
}
while (cm="ex");
return 0;
}
------ Build started: Project: hg, Configuration: Debug Win32 ------
Compiling...
yu.cpp
c:\documents and settings\long\桌面\hg\hg\yu.cpp(24) : error C2440: '=' : cannot convert from 'const char [3]' to 'char [3]'
There is no context in which this conversion is possible
Build log was saved at "file://c:\Documents and Settings\Long\桌面\hg\hg\Debug\BuildLog.htm"
hg - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
这是怎么回事?请武林高手指教指教。