This has been bugging the hell out of me. I have a tax calculator that I making in the console to make sure I understand how simple math works but I keep getting an error "non-lvalue in assignment" and a warning that I am "converting to 'int' from 'floant'" (yet I don't do know how to convert data types yet). I am using Dev-C++ and this website's tutorials. This is the code:
Error* = converting to int from floatCode:#include <iostream> using namespace std; int main() { //variables float item_cost; float tax_rate; float result; float tax; cout<<"Tax Calculator \n"; cout<<"How much does your item cost:"; cin>> item_cost; cin.ignore(); cout<<"\n"; cout<<"What is your area's tax rate:"; cin>> tax_rate; cin.ignore(); cout<<"\n"; cout<<"Calculating... \n"; if (tax_rate > 0) { return tax_rate = tax_rate/100; //error* return item_cost * tax_rate = tax; //error** return item_cost + tax = result; //error** } else { return item_cost = result; //error* return tax_rate = 0; //error* } cout<<"Report: \n"; cout<<"Item Cost: "<<item_cost<<"\n"; cout<<"Tax Rate: "<<tax_rate<<"\n"; cout<<"Tax: "<<tax<<"\n"; cout<<"Total: "<<result<<"\n"; cin.get(); }
Error** = non-lvalue in assignment
I have no clue why it gives me those errors. D:



LinkBack URL
About LinkBacks


