2017-09-20 53 views
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; 
} 
+0

您的代碼[編譯正常](https://www.ideone.com/roQrVM)。有什麼問題? –

回答

2

你缺少一個包含文件的代碼。

#include <string> 
相關問題