So I have a program where I can input a number from 0 to 40 as one variable, and a number from 0 to 8000 as another variable.
Depending on the numbers, there are certain formulas I need to use. If the number for the first variable is multiple of ten(0,10,20, etc), I use one set of equations, and any other number uses a different set of equations. If the number for the second variable is a multiple of a thousand (0,1000,2000, etc.) I use one set of equations and likewise if it's not.
I'm kind of stuck on a way to pick out those numbers and use the correct formulas.
I've tried an "if" function followed by an "else if" for the other variable.
Code:
if(at = 0.0 || at = 10.0 || at = 20.0 || at = 30.0 || at = 40.0)
{
printf("\nEnter the performance values that correspond to the temperature and pressure altitude given. \n");
printf("Low alt: ");
scanf("%lf", &sdt);
printf("High alt: ");
scanf("%lf", &ldt);
//Calculate distance for even temp
nwd = sdt + (paas - la)/(ha - la) * (ldt - sdt);
}
else if(paas = 0.0 || paas = 1000.0 || "etc etc" || paas = 8000.0)
{
printf("\nEnter the performance values that correspond to the temperature and pressure altitude given. \n");
printf("Low temp: ");
scanf("%lf", &sda);
printf("High temp: ");
scanf("%lf", &lda);
//Calculate distance for even alt
nwd = sda + (at - lt)/(ht - lt) * (lda - sda);
}
Using this method, I get an "Lvalue required as left operand of assignment" error by the if statements. Both "at" and "paas" are doubles.
Help is appreciated. I'm a beginner when it comes to programming. This isn't part of a class or anything, I'm just trying to develop a simple little program to do some calculations for me that I do on a regular basis as a pilot.
Thanks!