我不断获得
二进制">>"没有找到类型"类型"(或没有可接受的转换)或错误代码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 << "nnTip amount:t$" << tip;
cout << "nTotal bill:t$" << tip + bill;
cout << "nn" << fname << ":t$" << (tip + bill) / 3;
cout << "n" << sname << ":t$" << (tip + bill) / 3;
cout << "n" << tname << ":t$" << (tip + bill) / 3;
return 0;
}
您缺少一个包含文件。
#include <string>