int main()
{
cout << "please enter a floating-point value:";
double n;
cin >> n;
cout << "n==" << n
<< "\nn+1==" << n + 1
<< "\nthree times n==" << 3 * n
<< "\ntwice n==" << n + n
<< "\nn squared==" << n * n
<< "\nhalf of n==" << n / 2
<< "\nsquare root of n==" << sqrt(n)
<< endl;
}
输出的结果就是这个
please enter a floating-point value:
using namespace std;
void main()
{
cout << "please enter a floating-point value:";
double n;
cin >> n;
cout << "n==" << n
<< "\nn+1==" << n + 1
<< "\nthree times n==" << 3 * n
<< "\ntwice n==" << n + n
<< "\nn squared==" << n * n
<< "\nhalf of n==" << n / 2
<< "\nsquare root of n==" << sqrt(n)<< endl;
}