0
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;
}
您的代碼[編譯正常](https://www.ideone.com/roQrVM)。有什麼問題? –