# Thread: Big problem how to calculate units

1. ## Big problem how to calculate units

I am having a problem with the line that calculates the data. It keeps saying non-lvalue. I noticed
there are differences between, my book (borland) and my compiler (bloodshed), am I using an old method to calculate units? Any help you can offer would be greatly appreciated.

Code:
```// Height in miles
// going to be a program to calculate height in diff units

#include<iostream>

main()
{

unsigned int feet;
unsigned int inches;
unsigned int heightIninches;
unsigned int heightInmiles;
unsigned int f = 5280;

std::cout<<"What is your height? \n  ";  //outputs the question to the screen
std::cout<<"First give the feet, then the inches, ok? \n ";
system ("pause");
std::cout<<"OK First, how many feet are you tall? \n ";
std::cin>>feet;                   //allows input to the num variable
system ("pause");
std::cout<<"and now the trailing number of inches you are tall \n ";
std::cin>>inches;

feet*12+inches=heightIninches;
return heightIninches;

std::cout<<"So your height in inches is "<< heightIninches << "\n";
system ("pause");
std::cout<<"To see you height in miles press any key  \n";
system ("pause");

f/heightIninches = heightInmiles;

return heightInmiles;
std::cout<<"You are "<< heightInmiles << " miles tall \n";
system ("pause");
return 0;

}

//63360 = num of inches in a mile```

2. the problem is here:
Code:
```feet*12+inches=heightIninches
//the variable that you want to have a value assigned
//to should be on the left side of the assign operator
//you don't write:
12 = x; //you write:
x = 12;
//so \$\$\$\$ch them arround:
heightIninches = (feet*12 + inches);```
you don't need the return heigtIninches that is in the next line.
Do the same for height in miles....

also
Code:
`int main()`
and istead of writing std::whatever, you could just have this:
Code:
```#include <iostream>
using namespace std;```
some say this clutters stuff up, but for your usage it is great!

axon

3. ## For future reference....

codebrain,
l-value means left-value.

A statement with an equal sign is an assignment statement. Its NOT a mathmatical equation. It makes the variable on the left equal to the value of whatever is on the right.

These two statements are NOT the same (in programming).
x = y ; // Make x equal to y
y = x ; // Make y equal to x

In BASIC, the assignment statement is also called a LET statment. (The word "LET" is optional in BASIC):

LET x = 12 'This is BASIC... Don't try it in C++ !!!