小编QM *_*ams的帖子

类型'int'和'const char [15]'的无效操作数到二进制'operator <<'^

我正在尝试做一个简单的数学问题,但我不断收到此错误消息.怎么了?我正在使用cloud9 ide.

/home/ubuntu/workspace/Sphere.cpp:在函数'int main()'中:/ home /ubuntu/workspace/scc.c:20:63:错误:类型'int'和'const char [15]的无效操作数]'到二元'运算符<<'cout <<"圆的面积是:"<< 3.14*米^ 2 <<"米平方"<< endl;

这是整个代码:

#include <iostream>

using namespace std;

int main() {

    // Declare the radius
    int meters;
    cout << "Please enter the radius in meters: ";
    cin >> meters;

    // Calculate Diameter

    cout << "The diameter of the circle is: " << meters*2 << "m" << endl;

    //Calculate Area
    double PI;
    PI = 3.14;

    cout << "The area of the circle is: " << 3.14*meters^2 << "meters squared" << …
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
430
查看次数

标签 统计

c++ ×1