Reputation: 13
I keep getting
binary ">>" no operator found which takes a right-hand operand of type "type" (or there is no acceptable conversion) or error code C2679.
I tried adding #include <string>
which also didn't work for me.
Here is the code I have any help would be appreciated
#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;
}
Upvotes: 1
Views: 48