Needs to be a modified lvalue

Hello, I am trying to figure out why it keeps throwing me this error. The only way it lets me get rid of it is by entering == on each equation. Then i get a huge number thats definitely not what i am looking for. Any help would be greatly appreciated. Oh and I am MS Visual studio 2010
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 //Moses wants to purchase a new electronic bible so that he can follow along with the minister at church, while appearing to his peers 
//to be engaged in texting. The device costs $297.00 plus sales tax and shipping. Write a C++ program that prompts the user to enter from 
//the keyboard the sales tax rate percentage and the shipping cost. After converting the tax rate percentage to a decimal, 
//your program should output the sales tax amount, the shipping cost, and the total cost of the electronic bible.

#include<iostream>
using namespace std;


int main()
{
    double tax_percentage;
    double shipping_cost;
	double cost_of_device;
	float total_cost;
	float total_tax;
	int  tax;

cout<<"Thank you for choosing this program to calculate the total cost of your item. We hope you will be satifisfied with our service .\n";
cout<<"To begin, Would you please enter the cost of the item.\n";
cin>>cost_of_device;
cout<<"Now could you please enter the sales tax percentage.\n";
cin>>tax_percentage;
cout<<"Now please enter the shipping cost.\n";
cin>>shipping_cost;

tax_percentage/100= tax; //here
tax * cost_of_device= total_tax; //here


cout<<"You stated the cost of your device was "<<cost_of_device<<endl; 
cout<<"You stated the sales tax percentage of your order was "<<tax_percentage<<endl;
cout<<"Finally you said the shipping cost for your device was "<<shipping_cost<<endl;
tax + shipping_cost + cost_of_device=total_cost; //here
cout<<"There the total cost of your device is "<<total_cost<<endl;

system("pause");
return 0;


}

Last edited on
1
2
tax = tax_percentage / 100; //here
total_tax = tax * cost_of_device; //here 


The value of an expression is an lvalue and so cannot be assigned to.
http://eli.thegreenplace.net/2011/12/15/understanding-lvalues-and-rvalues-in-c-and-c/
Topic archived. No new replies allowed.