gpt4 book ai didi

c++ - 不匹配 'operator <<' ?

转载 作者:行者123 更新时间:2023-11-30 01:34:45 26 4
gpt4 key购买 nike

<分区>

我编写了一个使用结构并允许用户输入一个点然后输出该点的程序,但是当我运行该程序时它给出了错误:main.cpp:19:10: error: no match for 'operator<<'(操作数类型是 'std::ostream {aka std::basic_ostream}' 和 'Point') cout << 结果;

这是什么意思?

#include <iostream>
using namespace std;

struct Point {
double x, y;
};

// get a point from user input
Point input_point() {
double x, y;
cin >> x >> y;
Point p = {x, y};
return p;
}

int main() {
Point result;
result = input_point();
cout << result;
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com