Basically I have my doubles set in c++ and for some reason it gives me this error
"..\project2_name.cpp:56:9: error: assignment of function 'double total(double, double, double)'".
double appleprice=0;
double pearprice=0;
double tomatoprice=0;
double completetotal=0;
double total(double appleprice, double pearprice, double tomatoprice)
{
total = appleprice + pearprice + tomatoprice;
return total;
}
I have a switch case that calls this from a menu that works except the total: case '3': cout<< "You added a tomato" << endl; tomato = productsadd(tomato); price = 3.02; tomatoprice = addprice(price); cout << "You have on order " << tomato << " tomatos." << endl; break;
case '4':
cout<< "Your Full order" << endl;
completetotal = total(appleprice, pearprice, tomatoprice);
cout << "You have on order " << apple << " apples. " << appleprice << " price."<< endl;
cout << "You have on order " << pear << " pears. " << pearprice << " price."<< endl;
cout << "You have on order " << tomato << " tomatos. " << tomatoprice << " price."<< endl;
cout << "You have a total of " << completetotal << endl;
break;
total
is the name of the function. You cannot assign to the function. Make a temporary variable instead. – krzaq