>" no operator found 的任何修复-6ren"> >" no operator found 的任何修复-我不断得到 binary ">>" no operator found which takes a right-hand operand of type "type" (or there is no -6ren">
gpt4 book ai didi

c++ - 错误 : binary ">>" no operator found 的任何修复

转载 作者:行者123 更新时间:2023-11-30 02:23:20 24 4
gpt4 key购买 nike

我不断得到

binary ">>" no operator found which takes a right-hand operand of type "type" (or there is no acceptable conversion) or error code C2679.

我尝试添加 #include <string>这对我也不起作用。

这是代码,如果有任何帮助,我将不胜感激

#include<iostream>
#include <iomanip>

using namespace std;

int main()
{
cout << setprecision(2) << fixed;
string fname, sname, tname;
float bill, tip;
cout << "Enter first friend name: ";
cin >> fname;
cout << "\nEnter second friend name: ";
cin >> sname;
cout << "\nEnter third friend name: ";
cin >> tname;
cout << "\nEnter amount of bill: $";
cin >> bill;
tip = 0.15*bill;
cout << "\n\nTip amount:\t$" << tip;
cout << "\nTotal bill:\t$" << tip + bill;
cout << "\n\n" << fname << ":\t$" << (tip + bill) / 3;
cout << "\n" << sname << ":\t$" << (tip + bill) / 3;
cout << "\n" << tname << ":\t$" << (tip + bill) / 3;
return 0;
}

最佳答案

您缺少一个包含文件。

#include <string>

关于c++ - 错误 : binary ">>" no operator found 的任何修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46312741/

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